> -----Original Message-----
> From: brady jacksan [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 18, 2003 3:50 PM
> To: [EMAIL PROTECTED]
> Subject: Using alternatives and anchors
> 
> 
> 
> I am writing a script that will read from a file named  
> myfiles not stdin and print the lines containing the 
> following words "everywhere" or  'nowhere.
> 
>  
> 
> #!/usr/bin/perl
> #use strict
> while (<>) {
>   chomp;
>   if (/^everywhere$|^nowhere$/)
>     print
> 
> }
> 
> How do I invoked the file myfiles at the beginning of the 
> script? Any help is appreciated.
> 
> Brady
> 
>

use strict;
use warnings;

open(F,'path\to\myfiles') || die "Cannot open: $!";
while(<F>)
{
        print if /everywhere|nowhere/;
}
close(F);



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to