Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Hi All Perl Gurus, I am a AIX/Linu

Hi All Perl Gurus, I am a AIX/Linu

Hi All Perl Gurus, I am a AIX/Linu

Hi All Perl Gurus,
I am a AIX/Linux Admin, I am writing a shell script where i m
using the following line ...

perl -e ' use Time::Local; print scalar timelocal( $NSec, $NMin, $NHour, $NDay, $NMonth, $NYear)'

But it giving me error as below ....

Day '' out of range 1..31 at -e line 1

Any help will be very help full ... how to cope with this problem ...

RE: Hi All Perl Gurus, I am a AIX/Linu


If I understand your problem correctly, you are setting 6 shell variables then wondering why no Perl variable exist with the same names.

Either change the single quotes ( ' ) to double quotes ( " ) so the shell's variable expansion alter the Perl code before execution :

CODE --> command-line

master # NDay=21;NMonth=06;NYear=12;NSec=15;NMin=30;NHour=12

master # perl -e "use Time::Local; print scalar timelocal $NSec, $NMin, $NHour, $NDay, $NMonth, $NYear"

Or export you variables and tell Perl that you are talking about environment variables :

CODE --> command-line

master # export NDay=21 NMonth=06 NYear=12 NSec=15 NMin=30 NHour=12

master # perl -e 'use Time::Local; print scalar timelocal $ENV{NSec}, $ENV{NMin}, $ENV{NHour}, $ENV{NDay}, $ENV{NMonth}, $ENV{NYear}'


RE: Hi All Perl Gurus, I am a AIX/Linu

Hi Dear,
U r awesome dude ....
Thank U Soooo Much ....

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close