The –p switch is causing Perl to iterate over the inputs as if they were filename arguments.

 

Try this instead…

 

echo 4.56 | perl -e '$var1 =<STDIN>; $var2 = $var1 * 100; print "$var2\n"'

 

cn

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Arijit Das
Sent: Wednesday, January 25, 2006 5:47 AM
To: [email protected]; [email protected]
Subject: Strange behaviour in Perl

 

I am just wondering why is this giving a strange result. Any clues...?

 

bash-2.01$ echo 4.56 | perl -p -e 'my $var1 = <STDIN>; $var2 = $var1 * 100;  print $var2;'
04.56
bash-2.01$

 

I am expecting 456 in the ouput instead of 4.56

 

Am I missing anything...?

 

Thanks,
Arijit

 


Do you Yahoo!?
With a free 1 GB, there's more in store with Yahoo! Mail.

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to