> 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
>
Hi Brady,
If you have a perl cookbook, you will get the answer easily. Here it is:
#!/usr/bin/perl -w #you should use this to remind you of errors
use strict;
my $file = "myfiles"; # or you can use: my $file = shift; and feed the
# file name on commandline
open (FH, "<$file") || die $!; # you can check: "perldoc -f open" for
# details
while (<FH>){ #feed the file here
...
}
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]