in reply to .. operator and not including the condition of right operand
This variation:
my @aap = qw( 0aap 0noot 1mies 2mies 0aap 0noot 1mies 6mies ); foreach (@aap) { if (my $test = ( /^1(.*)/ .. /^0(.*)/ )) { print "$test: $1\n"; } }
Prints:
1: mies 2: mies 3E0: aap 1: mies 2: miesSpot the "E0"?
Alternatively, you can set a flag in the right hand side.
Result:my @aap = qw( 0aap 0noot 1mies 2mies 0aap 0noot 1mies 6mies ); foreach (@aap) { if (/^1(.*)/ .. (my $last = /^0(.*)/ )) { unless($last) { print "$1\n"; } } }
mies mies mies mies
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: .. operator and not including the condition of right operand
by tlm (Prior) on Apr 28, 2005 at 02:16 UTC | |
by bart (Canon) on Apr 28, 2005 at 06:23 UTC | |
by tlm (Prior) on Apr 28, 2005 at 12:18 UTC |