in reply to Re^2: Problem in extracting alphanumeric string from file
in thread Problem in extracting alphanumeric string from file
It doesn't work on the hash or array container, but does work with their scalar elements:
use warnings; use strict; my %hash = (one => 1, two => 2); for my $key (keys %hash){ print "$key\n" if $key =~ /one/; } my @array = qw(one two three); for my $elem (@array){ print "$elem\n" if $elem =~ /one/; }
|
|---|