while (my $row =~ <$fd>) { $row =~ /^$/ and next; $row =~ s/[,|)|(]//g; chomp $row; next if $row =~ /^Smart/g; $row =~ s/^\s+//; my @temp; my $counter; if($row =~ /^array/) { push @temp,$_; next unless ($row =~ /^array/); } ## Aim is to have the resulting O/P Captured in $row .