OnTheEdge has asked for the wisdom of the Perl Monks concerning the following question:
I need to ask a question of you'all here...I have looked on this site and seen similar type problems, but nothing has helped me resolve this problem.
I am very new to perl--this is my first script. This script is a part of a larger one. I am having problems converting the default output of $Month from 2, to Mar or what ever the month is. Below is my code. Could someone please tell me what I am doing wrong. I am not getting anything in the output file.
my $file; my $path ='\/a\/notify\/'; my $rslt = 'result.txt'; my @files; $ext = "\.log"; ($Second, $Minute, $Hour, $DayOfMonth, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time); open(OUT, ">>$rslt"); if ($Month =0) { my $New_mo = 'Jan'; } if ($Month =1) { my $New_mo = 'Feb'; } if ($Month =2) { my $New_mo = 'Mar'; } if ($Month =3) { my $New_mo = 'Apr'; } if ($Month =4) { my $New_mo = 'May'; } if ($Month =5) { my $New_mo = 'Jun'; } if ($Month =6) { my $New_mo = 'Jul'; } if ($Month =7) { my $New_mo = 'Aug'; } if ($Month =8) { my $New_mo = 'Sep'; } if ($Month =9) { my $New_mo = 'Oct'; } if ($Month =10) { my $New_mo = 'Nov'; } if ($Month =11) { my $New_mo = 'Dec'; } print OUT $New_mo; close (OUT);
If you need further clarification, please let me know! I am eternally grateful for any help you may be able to give me! Thank you in advance!
~OnTheEdge
|
---|
Back to
Seekers of Perl Wisdom