Don't write it like this.Consider this case:

$ARGV[0] ==0;

then your statement :

my $time_in = $ARGV[0] || <STDIN>;

should be broken.

--Jeff Pang


-----Original Message-----
From: [EMAIL PROTECTED]
To: beginners@perl.org
Sent: Wed, 6 Sep 2006 1:58 PM
Subject: Re: pipe as an argument

On 9/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: 
Consider this: 
my $arg = @ARGV ? shift @ARGV : <STDIN>; 
 
 
Works as I expected, many thanks. 
However, my previous code was: 
 
my $time_in = $ARG[0] || <STDIN>; 
 
and it doesn't work, why and whats the different with yours? 
 
rgds, 
 
-- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response> 
 


________________________________________________________________________
Check out AOL.com today. Breaking news, video search, pictures, email and IM. All on demand. Always Free.

--
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