Really interesting! I changed the script to:
#!/usr/bin/perl use strict; use warnings; my $a=" 456 789 123 456 789 "; my $count; $count = $a =~ /\d+/g ; print "$count\n"; my @a = $a =~ /\d+/g ; $count = @a; print "@a\n"; print "$count\n"; $count = () = $a =~ /\d+/g ; print "$count\n";
The results are:<\p>
1 789 123 456 789 4 5
Could you please advise why the 1st digit group is gone the first time i call $a =~ /\d+/g ?
In reply to Re^2: The return value of m// (clues)
by sophate
in thread The return value of m//
by sophate
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |