Simple code runs on linux, but not on windows -- why?

T

Tassilo v. Parseval

Also sprach Tad McClellan:
Lukas Mai said:
Tad McClellan schrob:
[...]
You should not use modifiers that you don't understand. m//o is
useless for your pattern.
my $tail = $1 if $the_number =~ m/\d+(.*)/s;

Whoa! Don't do that!


Why not?

Because one day it will emit a warning.
The behaviour of
`my $foo if bar;' is undefined


I believe that that is incorrect.

The docs themselves use that form twice that I can see:

perl -ne 'print "$ARGV: $_" if /^\s+my\b.*\bif\b/' *.pod

perltooc.pod: my $class = ref $self if $self;
perlwin32.pod: my @g = File::DosGlob::glob($_) if /[*?]/;

And likewise some of the core modules use it as a trick to create static
variables. However, perl5.10 will have a new warning "Deprecated use of
my() in conditional" that went into blead just a few days ago.

Tassilo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top