help with qx?

Philippe Bruhat (BooK) philippe.bruhat at free.fr
Wed Feb 6 01:10:00 GMT 2008


On Wed, Feb 06, 2008 at 12:39:20AM +0000, Iain Barnett wrote:
>
> The script has a system call (to the svn command-line client), and it  
> could possibly return a lot of lines back so I don't want to store it in 
> an array, but process it as it's coming through. Is there a way to force 
> qx or `` into list context, or something equally helpful?
>
> e.g
>
> while( list qx($command) ) {
> 	do stuff...
> }
>

You can use the right half of the secret goaste operator to force list
context:

    ()= qx($command);

but I doubt that will DWYM.

Using open() will work better:

    open my $fh, '-|', $command or die "Boff! Thwacke!! Kapow!!!";
    while (<$fh>) {
        ...
    }

-- 
 Philippe Bruhat (BooK)

 Everyone acts their age... mental, if not physical.
                                    (Moral from Groo The Wanderer #92 (Epic))


More information about the london.pm mailing list