Thanks everyone for the input. Getting the date output is much easier in perl than I originally thought.
thanks! Geraldine > On Tue, 8 Mar 2005, Ankur Gupta wrote: > > > [EMAIL PROTECTED] wrote: > > > > > Hi, > > > Is there a way to store the output of a system call on unix? > > > > > > eg. system("date"); > > > > > use backticks... > > > > $date = `date`; > > This is, of course, exactly the wrong way to solve this problem. > > Perl has date facilities built in -- so *use them*! :-) > > $ perl -le '$now = scalar localtime time ; print $now' > Tue Mar 8 11:50:47 2005 > $ date > Tue Mar 8 11:50:48 EST 2005 > $ > > So, by default, you don't get the time zone the way the `date` command > does, but if you need that, it's not hard to extract. > > See -- > > perldoc -f time > perldoc -f localtime > > -- for details on the built in time handling functions. > > If you want to get fancier, CPAN modules like Time::Local, Date::Calc, > etc. > > http://search.cpan.org/~jhi/perl-5.8.0/lib/Time/Local.pm > http://search.cpan.org/~stbey/Date-Calc-5.4/Calc.pod > > And so on. > > There's a lot of thing that can be legitimately done by calling out to a > system command, but getting the date isn't really one of them :-) > > > > -- > Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>