After use-ing warnings (which will let Perl make some suggestions about possible problems) and strict, consider looking at the differences between <> and <STDIN> as they may apply to your problem:
(Note that as I'm on a Windoze system, ^Z (control-Z) terminates <> input; it's ^D on *nix IIRC.)c:\@Work\Perl>perl -wMstrict -le "print qq{Enter a array of any number of elements}; ;; my @x = <>; printf 'A:'; printf qq{ '$_'} for @x; print ''; ;; chomp @x; printf 'B:'; printf qq{ '$_'} for @x; " Enter a array of any number of elements 1 22 333 Q 444 55 66 77 ^Z A: '1 22 333 Q 444 ' '55 66 ' '77 ' B: '1 22 333 Q 444' '55 66' '77'
In reply to Re: simple perl program not working
by AnomalousMonk
in thread simple perl program not working
by heman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |