in reply to Re: The return value of m// (clues)
in thread The return value of m//
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 ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: The return value of m// (clues)
by kcott (Archbishop) on Apr 23, 2012 at 07:56 UTC | |
by sophate (Beadle) on Apr 23, 2012 at 09:41 UTC | |
|
Re^3: The return value of m// (clues)
by quester (Vicar) on Apr 23, 2012 at 07:04 UTC | |
|
Re^3: The return value of m// (clues)
by bimleshsharma (Beadle) on Apr 23, 2012 at 07:47 UTC |