Matt, m// is the pattern Match function, read up on it. If you're on a UNIX style system, use `man perl` to get a list of all the other manual pages available. Pattern matching (which is what you're doing) isn't something to be taken lightly as it can end up being VERY slow.
For the second script, read up on the CGI module. It should do a lot of what you want. You'll also need to read up on the `` (backtick) operator. -------------------------- David Olbersen iGuard Engineer 11415 West Bernardo Court San Diego, CA 92127 1-858-676-2277 x2152 > -----Original Message----- > From: Matt O'Neill [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 25, 2003 8:34 AM > To: David Olbersen > Subject: Re: Simple perl program > > > Thanks david that sorted it, what does that m/ do then? > > Also I need to create another script that will list the contents of a > directory on the server, i.e call the "ls" command from unix > and print it to > a web browser, got any tips on this? > > Matt. > > "David Olbersen" <[EMAIL PROTECTED]> wrote in message > news:<[EMAIL PROTECTED]>... > Matt, > > The first thing to consider is better indenting. Most editors > (vim, emacs, > etc.) can do this automagically for you. Here's your exact > code, slightly > reformatted: > > my ($file_name, $search_string) = @ARGV; > > open(INFILE, "< $file_name"); > > while (<INFILE>) { > if ($_ =~ $search_string) { > print "yes\n"; > exit(); > } > } > > print "no\n"; > > > The problem that you're having is that "$_ =~ $search_string" > is missing > something: what that =~ operator should do! > > Try changing that to "$_ =~ m/$search_string/" and you should be good. > > -------------------------- > David Olbersen > iGuard Engineer > 11415 West Bernardo Court > San Diego, CA 92127 > 1-858-676-2277 x2152 > > > > -----Original Message----- > > From: Matt O'neill [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, March 25, 2003 8:11 AM > > To: [EMAIL PROTECTED] > > Subject: Re: Simple perl program > > > > > > hi yeah, i have started to write the code but am having > > troubles with the > > various operators around the search bit, anyway here goes: > > > > my ($file_name, $search_string) = @ARGV; > > > > open(INFILE, "< $file_name"); > > > > while (<INFILE>) { > > > > if ($_ =~ $search_string) { > > > > print "yes\n"; > > > > exit(); > > > > } > > > > } > > > > print "no\n"; > > > > > > > > Thanks for your help > > > > "R. Joseph Newton" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Matt O'neill wrote: > > > > > > > Hi guys, > > > > > > > > I need a very simple command line perl program that takes two > > arguements, > > > > the frist being a filename and the second being a word to > > be searched > > for in > > > > that file. Then I simply want the result to print "yes" > > if arg2 is > > found, > > > > or "no" if it is not. > > > > > > > > Thanks for your help > > > > > > > > matt. > > > > > > Hi Matt, > > > > > > It's great to hear that you are getting started in your > programming > > studies! When you get your script written, and test it by > > trying to run it, > > write back with the code and the results. You will find many > > people happy > > to help you move forward in your efforts. > > > > > > Joseph > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > ---------- > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]