Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: bash vs perl

by sh1tn (Priest)
on Jan 11, 2008 at 18:39 UTC ( [id://661948]=note: print w/replies, xml ) Need Help??


in reply to bash vs perl

The shell scripts are almost always slower and the code is neither readable nor compact.

bash
for i in `seq 1 10`; do touch $i; done

Perl and derivatives
perl -e 'open F, ">", $_ for 1..10'
perl -e 'qx[touch $_] for 1..10'
ruby -e '10.times{|i| File.new i.to_s, "w"}'
ruby -e '10.times{|i| %x[touch #{i}]}'


Replies are listed 'Best First'.
Re^2: bash vs perl
by ikegami (Patriarch) on Jan 12, 2008 at 09:28 UTC
    touch and open '>' are hardly the same. You want utime

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-03-28 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found