perl - push not appending to the end of the array -
perl - push not appending to the end of the array -
db<2> n main::(/home/repsa/temper.pl:84): $tttdiskhumber=$mytemprecord[-1]; db<2> n main::(/home/repsa/temper.pl:87): push(@mymainrecord,$tttdiskhumber); db<2> p @mymainrecord t2agvio701vhost03t2adsap7011 db<3> p $tttdiskhumber hdisk6 db<4> n main::(/home/repsa/temper.pl:88): @mytemprecord=(); db<4> p @mymainrecord hdisk6o701vhost03t2adsap7011 db<5>
why lastly force not appending end of array? help appreciated....
oh is. problem you're sending carriage homecoming screen. it's trailing previous element in array.
$ perl -e'print "abc", "def\r", "ghi", "\n";' ghidef
you read windows text file on non-windows scheme without convert line endings, either in advance (using dos2unix
) or when read file (by using s/\s+\z//;
instead of chomp;
).
as jordanm suggested in comment, debugger's x
command show have improve p
.
$ perl -d loading db routines perl5db.pl version 1.33 editor back upwards available. come in h or `h h' help, or `man perldebug' more help. @a = ("abc", "def\r", "ghi"); 1; ^d main::(-:1): @a = ("abc", "def\r", "ghi"); db<1> s main::(-:2): 1; db<1> p @a ghidef db<2> x @a 0 'abc' 1 "def\cm" 2 'ghi' db<3> q
perl
Comments
Post a Comment