Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^13: partial matching of lines in perl

by AnomalousMonk (Bishop)
on Jun 16, 2020 at 08:41 UTC ( #11118124=note: print w/replies, xml ) Need Help??


in reply to Re^12: partial matching of lines in perl
in thread partial matching of lines in perl

when i run the above code, it is showing the error-undefined variable $file1.please help me

c:\@Work\Perl\monks\Sidd@786>dir do.txt Volume in drive C is Acer Volume Serial Number is 9840-785B Directory of c:\@Work\Perl\monks\Sidd@786 File Not Found c:\@Work\Perl\monks\Sidd@786>perl #use strict; use warnings; $file1 = 'goodfile.txt'; $file2 = 'badfile.txt'; open $h2, '<', $file2 or die "cannot open file2"; @a2 = <$h2>; close $h2; chomp @a2; $match = join '|', @a2; $match = qr/$match/; open $f3,'>',"do.txt" or die "$!"; open $h1, '<', $file1 or die "cannot open file1"; my @a1 = <$h1>; close $h1; # print grep {$_ !~ $match} @a1; print $f3 grep {$_ !~ $match} @a1; __END__ c:\@Work\Perl\monks\Sidd@786>cat do.txt don't you
Problem solved!


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2020-09-27 01:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (142 votes). Check out past polls.

    Notices?