Adrian Farrell wrote:
> 
> Hi,

Hello,

> running the command:
> date|awk '{print $2,$3}'
> 
> provides me with the output I require (i.e. the month and day, May 6).
> 
> however, when I try to call this from within a perl script:
> system("date|awk '{print $2,$3}'");
> 
> I get:
> awk: syntax error near line 1
> awk: illegal statement near line 1
> 
> any ideas? alternatively, does anyone have another way to generate the date
> in this format that I can assign to a variable?


use POSIX qw( strftime );

my $date = strftime '%b %e', localtime;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to