Re: catchDate

2005-09-09 Thread Todd W
"John W. Krahn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jeff 'japhy' Pinyan wrote: > > On Sep 8, Christopher Spears said: > > > >> I want to catch the various parts of the output of the > >> date command. Here is my script: > >> > >> my $date = system("date"); > > > > > > Yo

Re: catchDate

2005-09-08 Thread Binish A R
Christopher Spears wrote: I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system("date"); $date =~ /(\w+)/; my $day = $1; print "Day: $day\n"; Here is my output: Thu Sep 8 10:22:14 CEST 2005 Day: 0 What i

Re: catchDate

2005-09-08 Thread Gerard Robin
On Thu, Sep 08, 2005 at 01:25:18AM -0700 Christopher Spears wrote: > I want to catch the various parts of the output of the > date command. Here is my script: > > #!/usr/bin/perl -w > use strict; > > my $date = system("date"); with: my $date = localtime; woks fine. > What is going on? Does

Re: catchDate

2005-09-08 Thread John W. Krahn
Jeff 'japhy' Pinyan wrote: > On Sep 8, Christopher Spears said: > >> I want to catch the various parts of the output of the >> date command. Here is my script: >> >> my $date = system("date"); > > 1. system() does not RETURN the output of a command. > 2. backticks -- that is, `...` -- return the

Re: catchDate

2005-09-08 Thread Jeff 'japhy' Pinyan
On Sep 8, Christopher Spears said: I want to catch the various parts of the output of the date command. Here is my script: my $date = system("date"); 1. system() does not RETURN the output of a command. 2. backticks -- that is, `...` -- return the output of a command. 3. Perl provides a date

Re: catchDate

2005-09-08 Thread John W. Krahn
Christopher Spears wrote: > I want to catch the various parts of the output of the > date command. Is there something the date command can do that Perl's localtime(), gmtime(), POSIX::strftime(), etc. cannot do? perldoc -f localtime perldoc -f gmtime perldoc POSIX > Here is my script: > > #!/

Re: catchDate

2005-09-08 Thread Le Sun (Sandy)
Why not use `date' directly?If you want to use perl indeed,how about this: #!/usr/bin/perl -w system("date \"+Day: %d\""); Christopher Spears wrote: I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system("dat

Re: catchDate

2005-09-08 Thread Ranish
On Thursday 08 September 2005 13:55, Christopher Spears wrote: > I want to catch the various parts of the output of the > date command. Here is my script: > > #!/usr/bin/perl -w > use strict; > > my $date = system("date"); > > $date =~ /(\w+)/; > > my $day = $1; > > print "Day: $day\n"; > > Here i

RE: catchDate

2005-09-08 Thread Charles K. Clarkson
Christopher Spears wrote: : What is going on? Does this mean that nothing was : captured? Test it yourself. if ( $date =~ /(\w+)/ ) { my $day = $1; print "Day: $day\n"; } else { print "Nothing matched.\n"; } __END__ HTH, Charles K. Clarkson -- Mo

catchDate

2005-09-08 Thread Christopher Spears
I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system("date"); $date =~ /(\w+)/; my $day = $1; print "Day: $day\n"; Here is my output: Thu Sep 8 10:22:14 CEST 2005 Day: 0 What is going on? Does this mean t