in reply to How do I read an entire file into a variable?
#!/usr/bin/perl # open your file using a filehandle # called MYFILE open(MYFILE, "/home/me/myfile"); # slurp the contents of MYFILE into # the variable $myfle $myfile = (<MYFILE>); # seach for your text ... if ($myfile =~ m/some txt i look for/) { print "Found the text\n"; } # and look for more text if ($myfile =~ m/some other text i look/) { print "Got other text\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I read an entire file into a variable?
by ravi45722 (Pilgrim) on Aug 25, 2015 at 06:17 UTC | |
by Anonymous Monk on Aug 25, 2015 at 06:25 UTC |