#!/usr/bin/perl use warnings; use strict; my $file1 = 'C:/Users/Siddharth/Desktop/our.txt'; my $file2 = 'C:/Users/Siddharth/Desktop/my.txt'; my $search_file = ""; open(my $fh2, "<$file2"); while(my $line = <$fh2>) { $search_file .= $line; } open(my $fh1, "<$file1"); while(my $line = <$fh1>) { chomp($line); if($line =~ m/\w+\s+(.*)/) { my $search_string = quotemeta("$1"); if($search_file =~ m/(.*$search_string.*)/) { } else { print " $line\n"; } } else { print "Invalid line: $line\n"; } }
In reply to Re^18: partial matching of lines in perl
by Sidd@786
in thread partial matching of lines in perl
by Sidd@786
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |