Re: HOW: Check string existence in a file.



mrlawrencelam@xxxxxxxxx writes:
> Seeing my questin below and you will know that I don't know much about
> Perl. But I urgently need a simple Perl script that do this task:

This newsgroup is not for writing Perl programs for people (though you
may luck out and someone will do it anyway, because they're
sufficiently bored). It's about discussing Perl programs. So please
read the documentation first, and try and write some code; we're much
more inclined to help someone who's made a little effort than someone
who says, "I need you to write my code for me, for free, fast!".

> How do I write a little Perl script to read a file and check for a
> string?
>
> 1) Read the file "aaa.txt".

perldoc -f open
perldoc perlop (search for "I/O Operators")

> 2) If string "xxx yyy zzz" is in that file, then do action 1.
> 3) If not, then do action 2.

perldoc perlsyn

I hope these documentation references are helpful.

-=Eric
.



Relevant Pages

  • Re: Displaying a users group memberships
    ... Perl script. ... The user's username is passed to the script via the command ... perldoc -f split ...
    (perl.beginners)
  • RE: Segmentation Fault(Core dumped)
    ... But when I started testing my perl script, ... Compilation failed in require at ./test.pl line 13. ... > official business of Sender. ...
    (perl.dbi.users)
  • Re: query status of STDIN
    ... I have a perl script that most of the time is ... > status of STDIN, in case that came as a pipe? ... perldoc perlopentut ...
    (comp.lang.perl.misc)
  • Re: sharing variables-data perl-asp
    ... Also how do you invoke a perl script from an active server page? ... ASP in Perl. ... Why do you want to shell out to perl when you're already running perl? ...
    (comp.lang.perl.misc)
  • Re: environment variables in perl scripts
    ... Define a BEGIN block in your perl program. ... > perl script, something like: ... > environment variables are there and diag.txt shows ... > This communication is intended for the use of the ...
    (perl.dbi.users)