in reply to Want to get regexp list from file

Hi.

Regarding your post, try to add <pre>..</pre> around the code.

Regarding your problem, try something like:

my $regexp = shift; my $text = shift; open RE, $regexp; while(<RE>) { chomp; push @re, $_ } close RE; open TXT, $text; while(<TXT>) { for my $re (@re) { print if m!$re! } } close TXT
Sorry but I didn't test the code, but I hope this helps. Good luck.

Update: Thanks to ambrus for correcting my code.

Alberto Simões

Replies are listed 'Best First'.
Re^2: Want to get regexp list from file
by ambrus (Abbot) on Mar 26, 2005 at 20:39 UTC
    for my $re (@re) { print if m!re! }

    I guess you're missing a dollar sign before re.

Re^2: Want to get regexp list from file
by Fletch (Bishop) on Mar 27, 2005 at 01:12 UTC
    Regarding your post, try to add <pre>..</pre> around the code.

    Erm, ITYM add <code>...</code>.