Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Filtering Output from two files

by LanX (Saint)
on Feb 06, 2018 at 11:48 UTC ( [id://1208558]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1208558]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found