eXile has asked for the wisdom of the Perl Monks concerning the following question:
I don't want to process the line containing '0aap' (because it ended the .. operator), so I do something like:my @aap = qw( 0aap 0noot 1mies 2mies 0aap 0noot 1mies 6mies ); foreach (@aap) { if (/^1(.*)/ .. /^0(.*)/) { print "$1\n"; } } __END__ mies mies aap mies mies
which works but is harder to read, and less elegant. Do other people use more elegant/readable solutions for this?#!/usr/bin/perl my @aap = qw( 0aap 0noot 1mies 2mies 0aap 0noot 1mies 6mies ); foreach (@aap) { if (( /^1(.*)/ .. /^0(.*)/ ) && !/^0/) { print "$1\n"; } } __END__ mies mies mies mies
|
|---|