in reply to next if regex matches

You need code tags, but the linking of '\.log' suggests that you have square brackets around that in the regex. Try: next unless ($path =~ /\.log$/); Square brackets will turn that into a character class, testing for any of the individual characters of '.log'.

Have you looked at File::Find or glob for this task?

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: next if regex matches
by Limbic~Region (Chancellor) on May 14, 2003 at 20:43 UTC
    Zaxo,
    Exactly what I was thinking - unless there is something the OP isn't telling us, there is no need to even do the work.
    #!/usr/bin/perl -w use strict; while (glob("*.txt *.log")) { print "$_\n"; }
    Where you only get .txt and .log files, although I would have used <*.txt *.log>.

    Cheers - L~R