Parag Kalra wrote:
Hello All,

Hello,

This works on Linux -
perl -e 'foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print "I am
only addicted to - 'Shekels' \n" if ($_ =~ /^s.*/i) }'

This works on Windoze -
perl -e "foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print 'I am
only addicted to - Shekels' if ($_ =~ /^s.*/i) }"

How can I have 1 code that will run both on Nix & Windoze.

I don't have Windows to test this on, but try:

perl -le "/^s/i && print q/I am only addicted to - 'Shekels'/ for qw/Sugar Sex Simplicity Sleep Success Smoking/"



John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to