in reply to Creating Arrays on the Fly

Do you want something like:

my @responses; while (1) { my $response = <$remote>; if ($response eq 'SQLEND') { last; } else { push @responses, $response } }
--
<http://www.dave.org.uk>

Perl Training in the UK <http://www.iterative-software.com>

Replies are listed 'Best First'.
Re: Re: Creating Arrays on the Fly
by broquaint (Abbot) on Sep 11, 2001 at 17:33 UTC
    push(@data, $response) while(($response = <$remote>) ne 'SQLEND');
    Sorry, but infinite loops do give me the fear(tm) ;o)

    broquaint

Re: Re: Creating Arrays on the Fly
by sdl3 (Novice) on Sep 11, 2001 at 19:04 UTC
    I used this method excpet I modified it slightly. I changed if ($response eq 'SQLEND') { to if ($response =~ "SQLEND") { That seemes to clear up the infinite loop it produced. I assumed that it was due to a CR-LF at the end and tried cleaning it up with chomp but it didn't help. So in the interest of getting this project wrapped up I just searched for the SQLEND. Thanks for the help!
      Just be real sure the string "SQLEND" is never in the returned data...