Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/perl
- my @temparr=();
- my $data_file='input.data';
- open(DATFILE, $data_file) || die("Could not open file!");
- @array=<DATFILE>;
- close(DATFILE);
- foreach $element (@array)
- {
- chomp($element);
- my @rowarr=split(/\|/,$element);
- foreach my $record (@rowarr) {
- chomp($record);
- my $size=length($record);
- push @temparr, "$size ";
- }
- push @temparr, "\n";
- }
- print @temparr;
- $
- $ cat input.data
- ABCDE|asd|aserreadd|aadd|addff|werredfgfdg|zxv|
- ABC|asafdd|asadd|aadd|addff|dsfgfd|zxewrwev|
- ABCDEFG|asd|asadd|wwereweaadd|addff|weerwe|zxrev|
- $
- $ perl readinputdata.pl
- 5 3 9 4 5 11 3
- 3 6 5 4 5 6 8
- 7 3 5 11 5 6 5
- $
- $ ######################### desired output = highest number of each column
- $ 7 6 9 11 5 11 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement