Re: Simple perl program

2003-03-26 Thread Matt O'neill
works well now that great, I was wondering how could i get it to list the files from the subdirectories as well? maybe using the -d command ? cheers matt. "James Kipp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] . > > > Im now trying to list a directory, but only the files in t

Re: Simple perl program

2003-03-26 Thread Rob Dixon
R. Joseph Newton wrote: > > The problems with operators may come from the way some characters are used as control > characters in some contexts. It might be best to try the qr() [quote-regex] or qm() > [quotemeta] functions to insure that any control character is properly escaped. There's not qm(

Re: Simple perl program

2003-03-25 Thread R. Joseph Newton
Matt O'neill wrote: > 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; You indicated problems with the operators around the search. I'll assume you mean operators c

Re: Simple perl program

2003-03-25 Thread Rob Dixon
James Kipp wrote: > > Im now trying to list a directory, but only the files in that > > directory that > > finish with a perticular ending, say .html, i.e *.html. Ive > > got this far, > > but having troubles, wondering if you could have a look for me: > > I guess this was mailed off-list? Thank

RE: Simple perl program

2003-03-25 Thread Kipp, James
> Im now trying to list a directory, but only the files in that > directory that > finish with a perticular ending, say .html, i.e *.html. Ive > got this far, > but having troubles, wondering if you could have a look for me: > you are pretty close, try the following use strict; use warning

Re: Simple perl program

2003-03-25 Thread Rob Anderson
Do I get marks for this then? "Jeff Westman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sounds like a class homework assignment to me ;-) > > > > > > what code do you have so far? or are you having trouble getting started ? > > > --- "Kipp, James" <[EMAIL PROTECTED]> wrote: > >

RE: Simple perl program

2003-03-25 Thread David Olbersen
nal 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 tha

Re: Simple perl program

2003-03-25 Thread Aim
Hi, Just to add a hash option (assuming you have 2 files ), you will need to customise the regex; untested: __START__ open (FILE_A,$ARGV[0]) or die; open (FILE_B,$ARGV[1]) or die; while ( ) { if ( /^(\S+)\s/ ) { $A{$1}++; } } close(FILE_A); while ( ) {

RE: Simple perl program

2003-03-25 Thread David Olbersen
quot; 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 >

Re: Simple perl program

2003-03-25 Thread Matt O'neill
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 () { if ($_ =~ $search_string) { print "yes\n"; exit(); } } print "no\n"; Tha

Re: Simple perl program

2003-03-25 Thread R. Joseph Newton
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. > > Thank

RE: Simple perl program

2003-03-25 Thread Jeff Westman
Sounds like a class homework assignment to me ;-) > > what code do you have so far? or are you having trouble getting started ? > --- "Kipp, James" <[EMAIL PROTECTED]> wrote: > > > > I need a very simple command line perl program that takes two > > arguements, > > the frist being a filename

Re: Simple perl program

2003-03-25 Thread Rob Anderson
How about this case sensitive solution === #!perl -w use strict; my ($file_name, $search_string) = @ARGV; open(INFILE, "< $file_name") or die "Couldn't open $file_name for reading: $!\n"; while () { if ($_ =~ m/\Q$search_string\E/) { print "yes"; exit(); } } print "no";

RE: Simple perl program

2003-03-25 Thread Kipp, James
> > 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 what