Mandar Rahurkar wrote: > > Hi, Hello,
> I have attached my routine and its output. I dont understand the > output differemce between the @subj and $subjectno ? Why do I lose the > trailing zeros ? > > Thanks Mandar > > @subj= cat somefile.txt > print @subj; > > foreach (@subj) { > $subject_no=chomp($_); I don't think you understand how chomp() works: perldoc -f chomp chomp VARIABLE chomp LIST chomp This safer version of the chop entry elsewhere in this document removes any trailing string that corresponds to the current value of `$/' (also known as $INPUT_RECORD_SEPARATOR in the `English' module). It returns the total number of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ characters removed from all its arguments. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > print $subject_no,"\n"; > } > > ---------------------- > Output > --------------------- > @subj > 01 > 02 > 03 > > $subject_no > 1 > 2 > 3 The correct output, according to your program, would be: $subject_no 1 1 1 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>