Hi Omps, On Sat, 29 Dec 2012 22:12:14 +0530 Om Prakash Singh <torque.in...@gmail.com> wrote:
> Hi All, > > I am new to perl and while going through the chapters of Learning perl, > i just came through one excessive, while i was able to complete it, i > just came across something that didn't work and i couldn't find any > explanation for it. Would be great if i get some help in understanding > this behavior. > A few comments on your code: > below is the code > > print "the string: "; > $string = <STDIN>; > print "the no.: "; > chomp($number = <STDIN>); > $result = $string x $number; > print "the result is:\n$result"; > 1. Add "use strict" and "use warnings". 2. Declare all variables using "my". For more see: http://perl-begin.org/tutorials/bad-elements/ Regards, Shlomi Fish > > in the above code when i use > $result = $string x $number; > i get the right result, i.e. strings printed on two lines. > > but, when i use > $result = $number x $string; > I don't get any output at all, just wondering why this happens, any help > would be highly appreciable. > > Regards, > Omps -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Original Riddles - http://www.shlomifish.org/puzzles/ I may be a geek, but I’m a true Klingon geek‐warrior! And a true Klingon geek warrior ALWAYS bottom‐posts. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/