in reply to Re: Passing two arrays to a subroutine
in thread Passing two arrays to a subroutine

Thak you so much for your help

However when i am passing arrays like this, It is adding one extra $_ in my array

for ($h=0; $h<=$arg[1]-1; $h++) { my @colm=""; for ($t=0;$t<=$arg[2]-1;$t++) { push @colm, $act_table[$t][$h]; print "***##$act_table[$t][$h]\n"; } Column(\@act_table,\@colm); } } Alnfirstcol (@firstcol); ## Sends first column for alignment to Subro +utine Alnfirstcol #foreach my $item (@firstcol) { #print "$item \n"; #} ## Subroutine : Entity_conv ## Sends cellwise data to Entity module to convert entities ## After entity conversion sends cellwise data ThinSpace subroutine to + add thin space wherever required ## Sends column to Text_Nontext subroutine to evaluate whether column +is contains text data or non text data sub Column { no warnings; my $actcol=shift; my $col=shift; $colno++; foreach (@$col) { print "$_\n"; $_=~s/(<(?:Tr|Tc)(?:\s?\;?\s?\;?\d?)?>)(.*)/$1.Entity_convert( +$2)/eg; } foreach (@$col) { #print "After ## $_\n"; } ThinSpace(\@$col,\@$actcol); return (); }
Please let me know if i am doing any mistake Thank you

Replies are listed 'Best First'.
Re^3: Passing two arrays to a subroutine
by choroba (Cardinal) on Sep 27, 2010 at 18:18 UTC
    Using references does not change the array in any way. The problem must lie somewhere else - try to print, or better Data::Dumper, the array at various points in the program.
    BTW, instead of \@$col, you can use just $col.