At first I thought this would be an addition to the PerlMonks quotes node, but then I realized there was too much context. So here it is, the chatterbox conversation that demonstrates one of the virtues of a Perl Monk... a sense of humor:
OzzyOsbourne What happens if I set an array to a scalar?
jcwren Usually, you'll get the count of elements in the array, if you mean $scalar = @array
gaspodethewonderdog I believe you get the size of the array in the scalar
Fastolfe your computer explodes
Fastolfe I think he means @array = $scalar
OzzyOsbourne Crud. that's what I meant
jcwren Oh, right. Yes, you computer explodes
Fastolfe which would be equiv to @array = ($scalar)
myocom It's best to do that on someone else's computer.
Fastolfe oh ok, well your computer will be fine in that case
Fastolfe but for god's sake don't reverse it.. that's why we do 'perl -cw script.pl' to check it before we run it
Fastolfe and of course 'use strict' would catch it and let you know that your computer would explode at compile-time
myocom Though, just for the sake of providing an actual answer, you get an array with one element
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|