in reply to Appending print to a variable

Execute this code, making note of the order of the printouts, and I think you'll get the idea.

#!/usr/bin/perl -w use strict; print "well, here we are!\n"; pipe(READ, WRITE); my $original = select(WRITE); print "and now we're here...\n"; close(WRITE); select($original); print "almost done...\n"; print while(<READ>);

Replies are listed 'Best First'.
Re: Re: Appending print to a variable
by eric256 (Parson) on Jul 30, 2003 at 17:21 UTC

    Thanks alot for that. I even looked right at the pipe command but couldn't figure out how that would help. I've played with this a bit now and i think it will definitly do what i was looking for.

    I was wondering if there were reasons to do this instead of aliasing print? any advantages/disadvantages i should be aware of?

    ___________
    Eric Hodges
      It's not clear to me what you are proposing by "aliasing print". Could you clarify how you would do such a thing?

        not a clue...i was just picking it up from cianoz's post. I'll have to dig threw Apache::ASP and see if i can find that code.

        ___________
        Eric Hodges