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); print $line; if( $line =~ /Date:/m) { print "ok";} ----------- else you may try this way in case you have only one file (note) ----------- while (<>) { print "ok" if (/Date:/); } ------------ else the old way or looping over each element ------------ open (FILE , "<$ARGV[0]"); print "ok" if ( map { /Date:/ } (<FILE>) ); close FILE; -----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: open(FILE, $dirvalue) ; my @lines = <FILE>; print @lines; # prints the file contents if( @lines =~ m/Date:/) { print "ok";} close(FILE); here I can print @lines which gives me: Received: from pc_jrs.spacebel.be (pc_jr) by earth.spacebel (5.x/SMI-SVR4) id AA26092; Sun, 27 Oct 1996 16:44:52 +0100 Date: Sun, 27 Oct 96 17:38:51 PST From: John Reynolds <[EMAIL PROTECTED]> Subject: Ebnf2ps Now @lines does contain Date: characters but it does not return true anwswer. Could someone please help me as how I can achieve this. Thanx Ankit -- 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]