[Chicago-talk] Using "@" to reference element in array

Jay Strauss me at heyjay.com
Thu Oct 1 19:54:02 PDT 2009


Yeah, I see that now.

Thanks
Jay

On Thu, Oct 1, 2009 at 5:07 PM, tiger peng <tigerpeng2001 at yahoo.com> wrote:

>
> @array[2] is just an array with one element. ('a') ; and print prints out
> the element.
>
>  ------------------------------
> *From:* Jay Strauss <me at heyjay.com>
> *To:* Chicago.pm chatter <chicago-talk at pm.org>
> *Sent:* Thu, October 1, 2009 4:42:09 PM
> *Subject:* [Chicago-talk] Using "@" to reference element in array
>
> Hi,
>
> I just got a script at work where the writer used:
>
> my @array = qw[adf af a adf asdfd];
> print @array[2];
>
> And it works!!
>
> I thought that notation didn't go into effect until Perl6.
>
> I've always done $array[2], and never tried the style above.  Is there any
> reason not to adopt the style above in future Perl5 programming?
>
> Thanks
> Jay
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20091001/d76be67a/attachment.html>


More information about the Chicago-talk mailing list