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


In reply to Converting output from numeric values to text by OnTheEdge

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.