* max.spicer shaped the electrons to say...

It turns out that saying
print <$s>;
generally causes the script to hang, whereas saying
my $answer = <$s>;
print $answer;
works every time.  Could anyone enlighten me as to why this is?

print operates in list context - and reading from a filehandle, like <$s> is
list context. So it blocks, expecting to read more.

Retrieving data in scalar context, such as my $answer = <$s> only pulls one 
line.*

Hope that helps.

* - Really the input record separator: $/ which by default is "\n"

-D
--
<noah> the auto mechanic told me there was something wrong with my rear 
differential.
I told him I never took calculus.
_______________________________________________
Discuss mailing list
Discuss@lists.slimdevices.com
http://lists.slimdevices.com/lists/listinfo/discuss

Reply via email to