Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old September 23rd, 2000, 05:06 PM
CujoRbd CujoRbd is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 16 CujoRbd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0


what is this command in Perl?
what does it do?

i was just wondering what it did, as I am using it in a CGI, but am not sure exactly what it does.

any info on this at all would be appreciated. if you need more info, please let me know.


CujoRbd



Reply With Quote
  #2  
Old September 24th, 2000, 02:02 AM
dwarf dwarf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 300 dwarf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Well, its not that easy to explain grep() or map() functions in Perl. The Perl Archive has a really cool article that deals with grep at:

http://tlc.perlarchive.com/0008/01.shtml

Basically, the grep() functions uses regular expressions to make a list out of another list. This is a somewhat blunt explanation, so you should really go and read the article.

HTH.

Reply With Quote
  #3  
Old September 25th, 2000, 03:01 AM
CujoRbd CujoRbd is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 16 CujoRbd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0


thanks! that answered alot of my questions.

to explain further what i am doing, i am basically adapting an old script of mine, but don't remember why I had put in the 'grep()' command. with that page you gave me, i figured out that i must've put it in to count the amount of users i have under a specific list.

though this answers my question, it now brings up another one.

i am trying to basically get a printout of every user, along with some info within their specified user file.

the grep command i had there was this:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
@members = grep(/.cgi/, @members);[/code]

which had just sprung off of this:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
opendir (MEMBERDIR, "$MembersPath");
@members = readdir(MEMBERDIR);
closedir (MEMBERDIR);[/code]

so, basically i've opened up a certain directory and counted the amount of files that end in "cgi" (or the amount of users that are there, to be more specific).

what i was hoping to do for this was to add a "foreach" statement and basically print out each user's info. but as the grep counts files and doesn't really distinguish between them, i'm not really sure what to do.

what can i do instead then? is there a certain function/command that i should use? or what?

please help me here, as I'd really like to finally get this script complete.


THANKS!!!


Cujo



Reply With Quote
  #4  
Old September 29th, 2000, 01:11 AM
CujoRbd CujoRbd is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 16 CujoRbd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
^^^

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > grep() command?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway