On Wed, 14 Aug 2002, Jose Malacara wrote:
> Hello. I was wondering if there is a way to capture a system command into a
> perl variable. I know this is incorrect, but I basically want to do something
> like this:
>
> $date = system("date");
> print "Today is $date.";
You can use backticks instead, like this
$date = `date`;
After this you will have to chomp off the newline
perldoc -f chomp
Try and avoid backticks or system if possible, if you do decide to use
them make sure to check the exit status in $? (perldoc perlvar)
This particular task of yours can be done using localtime
perldoc -f localtime
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]