Hi everybody,
 to extract data columnwise from a file, the following code was written with 
the help of perl experts of this list. the script is as follows:
 
------------------------------------------------------------------------------------------------------------------------
 
#!usr/bin/perl 
use warnings;

my %hash;

$file= "try.txt";

open (FH, $file) or die;
@rows=<FH>;
close (FH);

#$y = scalar(@rows);
foreach $line (@rows) {
chomp $line;
$x = length $line;

for (my $j=0; $j<$x; $x++)
{

# to get value in each column of $line

push @{$hash{$j}}, substr $line,$j,1;

}
}

foreach my $hkey (keys %hash) {
print "@{$hash{$hkey}}\n";

}

--------------------------------------------------------------------------------------------------------------------------

the code isn't giving any errors but it also isn't printing the result as 
well. Please someone tell me why is this happeining..

thanks in advance..

aditi

Reply via email to