in reply to Re^2: Filtering Output from two files
in thread Filtering Output from two files

Due to broken indentation it's hard to read and I won't go into details.

Have a look at http://perl.plover.com/FAQs/Buffering.html and basic debugging checklist

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^4: Filtering Output from two files
by vighneshmufc (Acolyte) on Feb 06, 2018 at 12:25 UTC
    Sorry would indentation next time onwards. Basic what's happening is the big files have whitespace before and after each entry So I have to remove those while I store them to a key .
      > So I have to remove those while I store them to a key

      OK ... what is hindering you? :)

      update

      you are already using a regex to match empty lines, time to understand what they do

      perlre#Metacharacters

      ^ Match the beginning of the string Not in [] (or line, if /m is used) ... $ Match the end of the string Not in [], but can ... * Matches the preceding element 0 or more Not in [] times

      update

      and look again into marshall's code ;-)

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Wikisyntax for the Monastery

Re^4: Filtering Output from two files
by vighneshmufc (Acolyte) on Feb 06, 2018 at 15:52 UTC
    open (my ($fh2),$file2) or die $!; while (my $row = <$fh2>) { chomp $row; print "$row\n"; next if $row =~ /^\s*$/; my (@fields) = split(/\|/, $row);
    so i have to add $row =~ s/\s*$// after  next if $row =~ /^\s*$/; and it will work? i cant really check from here since i am at home and would have to wait another 12 hours
      i cant really check from here since i am at home
      1. Install perl at home
      2. Mock up some sample data
      3. Run your code at home against the sample data

      Now you will know whether it works without having to wait.