Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: convert shell to perl

by ncw (Friar)
on Aug 31, 2000 at 18:46 UTC ( [id://30532]=note: print w/replies, xml ) Need Help??


in reply to convert shell to perl

Something like this for the last if
# This isn't perlish at all but if you need a faithfull emulation... my $date = `date '+%m%d%y'|sed s/\ /_/g`; chomp($date); print "checking the existence of log"; if (-e "/local/home/admin/log${date}_box_50") { rename "/local/home/admin/temp_log_copy", "/local/home/admin/log$ +{date}_box_50a" or die "Failed to rename"; } else { rename "/local/home/admin/temp_log_copy", "/local/home/admin/log$ +{date}_box_50" or die "Failed to rename"; }
But really this is horrible! Stop trying to program for shell in perl and learn perl properly! I promise you you'll never look back. In fact whenever I'm writing a shell script now-a-days and I'm thinking about a loop or ...| awk {print $1} or something like that I'll reach for perl!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found