--- David Draley <[EMAIL PROTECTED]> wrote:
> Hello -
> 
> I am trying to scan a UNIX file for a string.  I used a filehandle to do 
> this task - (Below) How would I complete the same taks without using 
> filehandles? Would it be GREP??
> ------------------------------
> #!/usr/local/bin/perl
> 
> open (DD,"/etc/passwd") || die "cannot open: $!";
> 
> while (<DD>)
>       {
>               if (/cm398/)
>                       {
>                               print "$_ \n";
>                       }
> }
> 
> thank you

Hello David,

What's wrong with using a file handle?  That's how you you gain access to a file.

If you're on a *nix system, you could use grep, but then you have code that's not 
terribly
portable and, depending upon how you call grep and pass it arguments, you could open 
up a whopping
security whole.

Cheers,
Curtis "Ovid" Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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

Reply via email to