Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Embed Unix command inside unix command in perl

by cdarke (Prior)
on May 20, 2010 at 16:51 UTC ( #840981=note: print w/replies, xml ) Need Help??


in reply to Embed Unix command inside unix command in perl

In Korn shell and Bash using back-ticks is considered deprecated, partly because nesting them makes things difficult to read. You might be better off using:
`echo /tmp/filename.\$(date +%Y%m%d)`
Although spawning two child process and using another language (the shell) to do a bit of string handling with a date is rather over the top. Wouldn't it be better done in Perl?

Replies are listed 'Best First'.
Re^2: Embed Unix command inside unix command in perl
by Xilman (Friar) on May 21, 2010 at 06:46 UTC

    Although spawning two child process and using another language (the shell) to do a bit of string handling with a date is rather over the top. Wouldn't it be better done in Perl?

    I understood the OP's code to be a simple example which shows the requirement, not as a complete specification of his end product. If the shell command was something distinctly non-trivial, or perhaps not the same command on each run of the Perl script, it may be much harder to implement the complete program purely in Perl.

    Paul

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2020-07-16 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?