If you loop over m//g, you get one iteration for each match.
$daleks = "Red Dalek Black Dalek Gold Dalek";
while ($daleks =~ /(\w+)\s+Dalek\b/g) {
if (++$count == 3) {
print "The third Dalek is a $1 Dalek.\n";
}
}
NB that $1 always refers to the current match here.
Apparently you shouldn't use 'last' to get out of a loop like this. Don't know why yet.
Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )