in reply to convert shell to perl
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!# 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"; }
|
|---|