On Sun, Nov 18, 2001 at 08:53:59PM +0100, Andrea Holstein wrote:
> open FILE, "<filename";
> while (<FILE>) {
>       print(<FILE>,<FILE>,<FILE>,<FILE>), last if /your_word/;
> }
> close FILE;

This would not do what you expect.  <FILE> in list context reads all of the
lines in the given file, and print imparts list context to its arguments. 
What you'd see as a result of your code is the contents of the file past the
found line.

This is probably more along the lines of what you meant, with some of my own
prejudices thrown in.   :)

    open(FILE, "<filename") || die("Unable to open file: \l$!.\n");
    while (<FILE>) {
        if (/your_word/) {
            print scalar <FILE>, scalar <FILE>, scalar <FILE>, scalar <FILE>;
            last;
        }
    }


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to