in reply to Re: Extract field after keyword
in thread Extract field after keyword

Tried:

while (<DPSLOTFILE>) { my ($slot) = /$dpdrivloc:\s*(\d+)/; print "$slot"; }
and there was no output.... Part of me was thingking it might be an issue with an ASCII file. I tried opening the file using:
binmode (STDOUT);
and no difference...

Replies are listed 'Best First'.
Re: Re: Re: Extract field after keyword
by dragonchild (Archbishop) on Mar 19, 2004 at 20:07 UTC
    I just tried it, substituting my while-loop for yours and it works for me. Maybe posting your entire script and test file would help .....

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Re: Re: Re: Extract field after keyword
by Fletch (Bishop) on Mar 19, 2004 at 20:30 UTC

    You want print "$slot\n";, since otherwise your prompt might cover things up if you don't print anything else (depending on your shell).

      Yep, I should have had that.... My bad. I entered it and it inserted about 5 or 6 newline characters, but $slot is still null...