On May 8, Ga Bu said: >I am fairly new to perl and having problems with >pulling in multiple lines from a file so I can search >those lines and if it has the expression I am looking >for then I want to return to that file and search >again for the same pattern of lines again and then >search again for the pattern in those line and save it >to a file. > >Between each group of text is a "!" exclamation point. Then just tell Perl that a "line" is really just a series of characters that ends with "\n!\n". To do this, change the value of the $/ variable. The $/ variable (as described in perlvar) is the input-record-separator, which means that it holds the string that comes at the end of every record or "line" that you read. It defaults to "\n", meaning that "lines" end in a newline. { local $/ = "\n!\n"; # so that $/ gets its normal value afterward while (<FILE>) { # do something with $_ } } You might want to know about the /m modifier for regexes, which makes ^ and $ not match beginning and end of a STRING, but rather, beginning and end of a \n-line. my @parts = "abc\ndef\n" =~ /^(.*)$/mg; print "@parts"; # "abc def" -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734