in reply to Searching through a file
The output is:#!/usr/bin/perl use warnings; use strict; # # Using __DATA__ to test a loop. # my $string = 'test'; my $inputs = 'test.txt'; # open(my $table, "<", $inputs) or die "can't open $inputs.\n"; # while (<$table>) { while (<DATA>) { print if ( m/\Q$string\E/o ); } # close($table); __DATA__ test tst foo bar test This is a test This is something else.
C:\Code>perl match.pl test foo bar test This is a test
|
|---|