What Does $# Mean in Perl

What Does $# Mean in Perl

$#arrayname gives you the index of the last element, so if array @ret has 2 elements then $#ret is 1. And, as noted by Barry Brown, an empty array gives -1.

What does [email protected] mean in Perl?

The variables are shown ordered by the “distance” between the subsystem which reported the error and the Perl process…[email protected] is set if the string to be eval-ed did not compile (this may happen if open or close were imported with bad prototypes), or if Perl code executed during evaluation die()d.

What is $1 Perl?

Perl regular expressions are documented in perlre. $1, $2, etc will contain the value of captures from the last successful match – it’s important to check whether the match succeeded before accessing them, i.e. … As previously mentioned they contain the text from your last regular expression match.

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.