in reply to Re: checking the matches
in thread checking the matches

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: checking the matches
by ikegami (Patriarch) on May 22, 2008 at 17:01 UTC
    yeah, just chop them off from the hash key.
    my %hash = map { my($k,$v)=split/#/; $k=int($k); ($k,$v) } @array2; for (@array1) { my $k = int($_); next if !exists($hash{$k}); print("$hash{$k} = $_\n"); }

    Fix if you have duplicates:

    my %hash; for (@array2) { my ($k, $v) = split /#/; $k = int($k); push @{ $hash{$k} }, $v; } for (@array1) { my $k = int($_); next if !exists($hash{$k}); for my $v (@{ $hash{$k} }) { print("$v = $_\n"); } }
Re^3: checking the matches
by carol (Beadle) on May 22, 2008 at 18:09 UTC
    Yes, of course that is possible. But I think you should study regular expressions more. After a short while you will discover that it is possible and also how to do it.