Perldoc Search: "$*" perl-5.20.1

search official POD

6 PODs, 10 LINEs found.
1348 :     $* is no longer supported
1349 :         (D deprecated, syntax) The special variable $*, deprecated in older perls, has been removed as of 5.10.0 and is no longer supported. In previous versions of perl the use of $* enabled or disabled multi-line matching within a string.
1351 :         Instead of using $* you should use the "/m" (and maybe "/s") regexp modifiers. You can enable "/m" for a lexical scope (even a whole file) with "use re '/m'". (In older versions: when $* was set to a true value then all regular expressions behaved as if they were written using "/m".)
2300 :             $ref->$*;
551 :             Thus, after a match against $_, $& coincides with "substr $_, $-[0], $+[0] - $-[0]". Similarly, $*n* coincides with "substr $_, $-[n], $+[n] - $-[n]" if $-[n] is defined, and $+ coincides with "substr $_, $-[$#-], $+[$#-] - $-[$#-]". One can use $#- to find the last matched subgroup in the last successful match. Contrast with $#+, the number of subgroups in the regular expression. Compare with "@+".
1147 :     $*      $* was a variable that you could use to enable multiline matching. After a deprecation cycle, its magic was removed in Perl v5.10.0. Using it now triggers a warning: "$* is no longer supported". You should use the "/s" and "/m" regexp modifiers instead.
431 :       $sref->$*;  # same as  ${ $sref }
430 :          The system ignores the first line and feeds the program to /bin/sh, which proceeds to try to execute the Perl program as a shell script. The shell executes the second line as a normal shell command, and thus starts up the Perl interpreter. On some systems $0 doesn't always contain the full pathname, so the -S tells Perl to search for the program if necessary. After Perl locates the program, it parses the lines and ignores them because the variable $running_under_some_shell is never true. If the program will be interpreted by csh, you will need to replace "${1+"$@"}" with $*, even though that doesn't understand embedded spaces (and such) in the argument list. To start up *sh* rather than *csh*, some systems may have to replace the "#!" line with a line containing just a colon, which will be politely ignored by Perl. Other systems can't control that, and need a totally devious construct that will work under any of *csh*, *sh*, or Perl, such as the following:
211 :     By default, the "^" character is guaranteed to match only the beginning of the string, the "$" character only the end (or before the newline at the end), and Perl does certain optimizations with the assumption that the string contains only one line. Embedded newlines will not be matched by "^" or "$". You may, however, wish to treat a string as a multi-line buffer, such that the "^" will match after any newline within the string (except if the newline is the last character in the string), and "$" will match before any newline. At the cost of a little more overhead, you can do this by using the /m modifier on the pattern match operator. (Older programs did this by setting $*, but this option was removed in perl 5.10.)
3882 :               printf "%2\$*3\$d %d\n", 12, 34, 3;  # will print " 34 12\n"
<< Back to Perldoc Search