/ Forside / Teknologi / Udvikling / Perl / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Perl
#NavnPoint
bjarneA 141
poul_from 50
soccer 30
Nicknack 14
Tmpj 0
Searching files opened by Perl Script ->HE~
Fra : Sonahl


Dato : 13-04-01 22:47

Hi, I need help using Perl. I've tried looking through websites, but to no
avail. See, my program is supposed to search a phonebook depending on certain
criteria. I was able to create the phonebook, I was able to add entries to the
phonebook, but now, I don't know how to search the phonebook using the Perl
script.

Usually, without a perl script, I'd use the command

grep Ray phonebook

which means to display lines that contain "Ray" in it, but now, I just don't
know how to go about doing this. If you can help, I'll greatly appreciate it.

 
 
Gustav Kristoffer Ek (17-04-2001)
Kommentar
Fra : Gustav Kristoffer Ek


Dato : 17-04-01 23:48

In article <20010413174657.00938.00000058@ng-fx1.aol.com>,
sonahl@aol.completeA2Z (Sonahl) wrote:

> Hi, I need help using Perl. I've tried looking through websites, but to no
> avail. See, my program is supposed to search a phonebook depending on certain
> criteria. I was able to create the phonebook, I was able to add entries to the
> phonebook, but now, I don't know how to search the phonebook using the Perl
> script.

You should go to your favorite bookstore and buy one or more of Ora's
<http://perl.ora.com/> great perl-books to get some fundamental
understanding of perl programming.


> Usually, without a perl script, I'd use the command
>
> grep Ray phonebook

perl -e 'print grep /Ray/, (<>)' < phonebook

perldoc -f grep is your friend

-
gustav



--

Gustav Kristoffer Ek, Netcetera, Brolæggerstræde 4, 1211 København
K
+45 33147000, +45 20400005, fax +45 33146200 http://www.netcetera.dk/

Ask Bjoern Hansen (19-04-2001)
Kommentar
Fra : Ask Bjoern Hansen


Dato : 19-04-01 21:44

stoffer@netcetera.dk (Gustav Kristoffer Ek) writes:

> > Usually, without a perl script, I'd use the command
> >
> > grep Ray phonebook
>
> perl -e 'print grep /Ray/, (<>)' < phonebook

perl -ne 'print if /Ray/' < phonebook

vil ikke laese hele filen ind foerst.


- ask

--
ask bjoern hansen - http://ask.netcetera.dk/

Søg
Reklame
Statistik
Spørgsmål : 177547
Tips : 31968
Nyheder : 719565
Indlæg : 6408797
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste