Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: quoting problems passing pattern to shell in backquotes

by polettix (Vicar)
on Dec 28, 2007 at 10:00 UTC ( #659318=note: print w/replies, xml ) Need Help??

in reply to quoting problems passing pattern to shell in backquotes

While I understand playing on one's strenghts, I think you're using the wrong tool for the job. Perl is quite good at playing with text, so I don't fully understand your insistence upon using shell expansions. Apart from lack of knowledge of better tools, maybe :)

I'd suggest you to take a look to File::Find::Rule. Your problem can be solved quite easily:

#!/usr/bin/env perl use strict; use warnings; use File::Find::Rule; my $pattern = qr/ \A gcc # start with "gcc" - # first separating hyphen [^-]+ # first sequence of non-hyphen - # second - also last - separating hyphen [^-]+ # second sequence of non-hypen \.rpm \z # end with ".rpm" /mxs; my @files = File::Find::Rule->file()->name($pattern)->maxdepth(1)->in( +'.'); print "files: [@files]\n";
No shell expansion quoting headaches, no process spawning, comments in your pattern... and it even works!
poletti@PolettiX:~/sviluppo/perl/testdir$ ls gcc-32bit-4.2-24.x86_64.rpm gcc41-32bit-4.1.3_20070724-15.x86_64.rpm gcc41-4.1.3_20070724-15.x86_64.rpm gcc41-ada-4.1.3_20070724-15.x86_64.rpm gcc41-c++-4.1.3_20070724-15.x86_64.rpm gcc41-fortran-32bit-4.1.3_20070724-15.x86_64.rpm gcc41-fortran-4.1.3_20070724-15.x86_64.rpm gcc41-gij-32bit-4.1.3_20070724-25.x86_64.rpm gcc41-gij-4.1.3_20070724-25.x86_64.rpm gcc41-java-4.1.3_20070724-15.x86_64.rpm gcc41-locale-4.1.3_20070724-15.x86_64.rpm gcc41-objc-32bit-4.1.3_20070724-15.x86_64.rpm gcc41-obj-c++-4.1.3_20070724-15.x86_64.rpm gcc41-objc-4.1.3_20070724-15.x86_64.rpm gcc41-testresults-4.1.3_20070724-25.x86_64.rpm gcc-4.2-24.x86_64.rpm gcc42-32bit-4.2.1_20070724-17.x86_64.rpm gcc42-4.2.1_20070724-17.x86_64.rpm gcc42-ada-4.2.1_20070724-17.x86_64.rpm gcc42-c++-4.2.1_20070724-17.x86_64.rpm gcc42-fortran-32bit-4.2.1_20070724-17.x86_64.rpm gcc42-fortran-4.2.1_20070724-17.x86_64.rpm gcc42-gij-32bit-4.2.1_20070724-26.x86_64.rpm gcc42-gij-4.2.1_20070724-26.x86_64.rpm gcc42-info-4.2.1_20070724-17.x86_64.rpm gcc42-java-4.2.1_20070724-17.x86_64.rpm gcc42-locale-4.2.1_20070724-17.x86_64.rpm gcc42-objc-32bit-4.2.1_20070724-17.x86_64.rpm gcc42-obj-c++-4.2.1_20070724-17.x86_64.rpm gcc42-objc-4.2.1_20070724-17.x86_64.rpm gcc42-testresults-4.2.1_20070724-26.x86_64.rpm gcc-ada-4.2-24.x86_64.rpm gcc-c++-4.2-24.x86_64.rpm gcc-fortran-32bit-4.2-24.x86_64.rpm gcc-fortran-4.2-24.x86_64.rpm gcc-gij-32bit-4.2-24.x86_64.rpm gcc-gij-4.2-24.x86_64.rpm gcc-info-4.2-24.x86_64.rpm gcc-java-4.2-24.x86_64.rpm gcc-locale-4.2-24.x86_64.rpm gcc-objc-32bit-4.2-24.x86_64.rpm gcc-obj-c++-4.2-24.x86_64.rpm gcc-objc-4.2-24.x86_64.rpm poletti@PolettiX:~/sviluppo/perl/testdir$ perl files: [gcc-4.2-24.x86_64.rpm]

Hey! Up to Dec 16, 2007 I was named frodo72, take note of the change! Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Io ho capito... ma tu che hai detto?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://659318]
[Perl300]: I need suggestion for a module that'll help me to send email from my perl code. I want it secure and as simple as possible.
[Perl300]: I found from Super Search
[Perl300]: I found from Super Search, Net::SMTPS or Net::SMTP, MIME::Lite, Email as options
[1nickt]: Perl300 Try Email::Stuffer
[1nickt]: Or for a little more control, Email::Sender:: Simple
[Perl300]: any suggestion on which one might be secure and simplest. I am not doing anything complex, just check some conditions from DB tables and send email to myself (same domain) if conditions are met
[1nickt]: read the doc of the suggestions I just gave
[1nickt]: A lot depends on whether you are sending mail from your local box or using a remote server
[hippo]: Secure in what sense?
[Perl300]: I am sending from remote server

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2017-10-17 15:51 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (233 votes). Check out past polls.