On Fri, 28 Jun 2013 07:37:57 -0700 (PDT)
Rajeev Prasad <rp.ne...@yahoo.com> wrote:

> Shlomi/Uri,
> what do you mean by 'It's a good idea not to use "select" on filehandles like
> that because it willaffect the default filehandle permanently.'?

<SHELL>
shlomif@lap:~$ cat Test.pl
#!/usr/bin/perl

use strict;
use warnings;
use autodie;

open my $o, '>', 'myfile.txt';
select($o);

print "Hello World!\n";

close($o);
shlomif@lap:~$ perl Test.pl 
shlomif@lap:~$ cat myfile.txt 
Hello World!
shlomif@lap:~$ 
</SHELL>

As you can see, print no longer printed to STDOUT but instead printed to $o.

For more information, see http://perldoc.perl.org/functions/select.html .

Regards,

        Shlomi Fish

> 
> I am using perl 5.14

That's not too bad.

Regards,

        Shlomi Fish

> ty.
> 
> 
> 


-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
First stop for Perl beginners - http://perl-begin.org/

Reality to be conquered, must be obeyed. You’d better obey Chuck Norris or
he’ll conquer you.
    — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to