Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Passing commands to subroutines

by graff (Chancellor)
on Jul 02, 2009 at 04:43 UTC ( [id://776635]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Passing commands to subroutines
in thread Passing commands to subroutines

Given that you're facing a problem with tricky file names, the easiest substitute I could imagine for fixing a line of code like this:
system("program $ref_file > $outfile");
would be to do it like this:
open( PROG, "-|", "program", $ref_file ) or die "can't launch 'program +' on $ref_file: $!\n" open( OUT, ">", $outfile ); while (<PROG>) { print OUT; } close PROG; close OUT;
That ought to take any sort of goofy file name safely in stride (for both input and output files).

Replies are listed 'Best First'.
Re^4: Passing commands to subroutines
by Anonymous Monk on Jul 02, 2009 at 05:09 UTC
    Probably easier to use one of the IPC:: modules, maybe IPC::Cmd

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://776635]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2026-03-11 15:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.