I want to know the meaning of perl special variables $-[0] and $+[0]
I have googled and found that $- represent number of lines left on the page and $+ represent the last bracket matched by the last search pattern.
But my question is what $-[0] and $+[0] means in context of regular expressions.
Let me know if code sample is required.
There are some variables which have a predefined and special meaning in Perl. They are the variables that use punctuation characters after the usual variable indicator ($, @, or %), such as $_ ( explained below ).
$? is the error code of the child process (perform_task.sh). In the case of your script the return code is shifted eight bits to the right and the result compared with 0. This means the run is considered a failure only if the returned code is > than 255.
$PROGRAM_NAME $0. Contains the name of the file containing the Perl script being executed. On some operating systems assigning to " $0 " modifies the argument area that the ps(1) program sees. This is more useful as a way of indicating the current program state than it is for hiding the program you're running.
See perldoc perlvar about @+ and @-.
$+[0]is the offset into the string of the end of the entire match.
$-[0]is the offset of the start of the last successful match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With