Hello Singh, Chomp the $string and test again. Really sorry I cannot bottom post with BBerry phone.
Regards On 12/29/12, 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. > > 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"; > > > 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 > -- Sent from my mobile device -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/