Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
User Journal

Journal nocomment's Journal: perl gurus 4

I need a little help with this.

I have a script (written a long time ago and not by me that I'm trying to edit). It's supposed to be grabbing files based on the first three characters.

this part here is supposed to skip files that don't:

next if $temp[8] !~ /^int|ren|svr|crd|sls|pdn/;

it's grabbing files that are similar though like this one:

STMP.pdnjrnsai

ideas?

This discussion has been archived. No new comments can be posted.

perl gurus

Comments Filter:
  • You need to group the alternative patterns.

    Try: m/^(int|ren|svr|crd|sls|pdn)/;

    Saw this on Firehose BTW :)

    • kick ass (on both accounts).

      Fresh blood to the JE circle. :-)

      and that worked btw, thanks! Out of curiosity what did that do?
      • It groups the pipe-separated strings. think of it as "and" and "or"; eg /^abc/ only matches abc at the start of the line ^(a|b|c) means start of line, followed by "a", or by "b", or by "c" You really need the Camel book in your life :)
        • Hehe... when I first moved to ATL, a friend took me to a bar. He said most people there geeks and they have free WiFi. I sat down and they had Camel Cigarette coasters that were dark green with a white camel on them. I said, "Oh, and they have Perl coasters!" He lost it.

365 Days of drinking Lo-Cal beer. = 1 Lite-year

Working...