Re: Help in Regular expression with array

2002-06-05 Thread Eric Beaudoin
At 15:49 2002.06.05, Ankit Gupta wrote: Hello, I am facing a problem in using regular expression on array. My code is written below: open(FILE, $dirvalue) ; my @lines = FILE; print @lines; # prints the file contents if( @lines =~ m/Date:/) { print

RE: Help in Regular expression with array

2002-06-05 Thread Bob Showalter
-Original Message- From: Ankit Gupta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 05, 2002 3:49 PM To: [EMAIL PROTECTED] Subject: Help in Regular expression with array Hello, I am facing a problem in using regular expression on array. My code is written below:

RE: Help in Regular expression with array

2002-06-05 Thread Beau E. Cox
Hi - I don't think you can regex on a whole array; try this after you have loaded the array: for (@lines) {print ok if /Date:/; } This iterates the array lines presenting $_ for each iteration. The regex /Date:/ operates on $_. Aloha = Beau. -Original Message- From:

RE: Help in Regular expression with array

2002-06-05 Thread Shishir K. Singh
Don't know if you can do a search on an array (until and unless you want to evaluate each element) In case you are trying to achieve the multiple lines search, maybe this or the 2nd example can help : open (FILE , $ARGV[0]); my @lines = FILE; close(FILE); $line = join( , @lines);

RE: Help in Regular expression with array

2002-06-05 Thread Eric Beaudoin
At 16:12 2002.06.05, Shishir K. Singh wrote: open (FILE , $ARGV[0]); print ok if ( map { /Date:/ } (FILE) ); close FILE; map return an array with the result of the express apply to each line. Even if none of the lines in FILE contain Date:, you will have an array with one value for each

RE: Help in Regular expression with array

2002-06-05 Thread Shishir K. Singh
!! -Original Message- From: Eric Beaudoin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 05, 2002 4:29 PM To: Shishir K. Singh Cc: Ankit Gupta; [EMAIL PROTECTED] Subject: RE: Help in Regular expression with array At 16:12 2002.06.05, Shishir K. Singh wrote: open (FILE , $ARGV[0]); print ok

RE: Help in Regular expression with array

2002-06-05 Thread Timothy Johnson
] Subject: RE: Help in Regular expression with array Beau..I guess , the evaluation of the expression is not going to be true if no Date: is found. Since map returns a list consisting of the results of each successive evaluation of the expression..., the map will return undef. Although, here..I