#!/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"; }
In reply to Re: How do I read an entire file into a variable?
by Anonymous Monk
in thread How do I read an entire file into a variable?
by sgtbaker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |