Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: How to get only files ending with a ,

by Paladin (Priest)
on Jan 11, 2006 at 22:24 UTC ( #522580=note: print w/replies, xml ) Need Help??

in reply to How to get only files ending with a ,<word>

You'll have to be a bit more specific on what is not working. It seems to work just fine here:
[~/tmp]$ touch foo,bar [~/tmp]$ touch baz [~/tmp]$ touch foo,baz [~/tmp]$ touch a b c [~/tmp]$ perl . foo,bar foo,baz

Replies are listed 'Best First'.
Re^2: How to get only files ending with a ,<word>
by perlNinny (Beadle) on Jan 11, 2006 at 22:32 UTC
    Yes, you are right. What I want is this: I want the list to contain only the portion after the ,. So, using your example, I want to see bar bas and each a separate element in the list. THANKS for the help!
      Then something like:
      my @comma_extensions = map { /,(\w+)$/ ? $1 : () } @files;
      will produce what you want.

      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://522580]
[1nickt]: choroba no kidding! The muscle memory alone makes it insignificant. I suppose the addition of param checking is nice. But if you are using MOo anyway you are using Type::Tiny, and you can easily use T::T for params in regular methods.
[choroba]: And regarding SQL, I'm usually generating SQL directly from queries supplied by the user, so I don't see how DBIx::Class can help me.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-11-24 14:02 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (349 votes). Check out past polls.