in reply to Regex and array
if you tested negative for corion's explanation which is usually the case(people usually tend to open a file that does not exists), try this:
i always use grep or map when going through arrays or hashes, try it, it's a lot of fun !#!/usr/bin/perl use strict; my @array = qw(q e t u o); while(<DATA>){ chomp(my $r = $_); grep{print "$_\n" if ($r =~ /$_/g)}@array; } __DATA__ ff qksjnfji klksnsd jkksdjen rjkaa
cheers
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex and array
by toolic (Bishop) on May 25, 2010 at 13:30 UTC | |
|
Re^2: Regex and array
by Deus Ex (Scribe) on May 25, 2010 at 13:11 UTC |