views:

285

answers:

1

I have some code from http://www.hyllander.org/node/23 that uses $* ("dollar asterisk" or "dollar star"), but my version of perl reports:

$* is no longer supported at migrate.pl line 284.

Do you know what were the side-effects of doing

$*=1

Did that somehow affect functions like split or tokenizers or regular expressions?

+14  A: 

Here's part of the output of perldoc perlvar:

$* Set to a non-zero integer value to do multi-line matching within a string, 0 (or undefined) to tell Perl that it can assume that strings contain a single line, for the purpose of optimizing pattern matches. Pattern matches on strings containing multiple newlines can produce confusing results when $* is 0 or undefined. Default is undefined. (Mnemonic: * matches multiple things.) This variable influences the interpretation of only "^" and "$". A literal newline can be searched for even when "$* == 0".

Use of $* is deprecated in modern Perl, supplanted by the "/s" and "/m" modifiers on pattern matching.

Assigning a non-numerical value to $* triggers a warning (and makes $* act if "$* == 0"), while assigning a numerical value to $* makes that an implicit "int" is applied on the value.

innaM
Thanks! (I was having trouble finding the `$*` using google, since that search engine ignores such keywords.)
scraimer
@scraimer: You should first consult the documentation installed on your computer: `$ perldoc perltoc`
Sinan Ünür
Except that the documentation installed on my computer is for perl 5.10, and since `$*` has been discontinued by that version, the documentation no longer has it.
scraimer
Nothing is stopping you from looking the documentation for earlier versions of Perl.
brian d foy