Phoenix.pm: Perl 101
jim mckay
jimm at amug.org
Fri Jul 7 16:48:03 CDT 2000
Look on page 133 of the camel book $" is the list seperator!
#!/usr/bin/perl
$"=",";
@author = ('Tom', 'Randal', 'Larry');
print "@author\n";
print @author;
print "\n";
outputs
Tom,Randal,Larry
TomRandalLarry
VERY COOL! This is gona save me tons of time in formatting output..
Jim M
On 7/7/00 at 1:23 PM, doug.miles at bpxinternet.com (Doug Miles) wrote:
> In retrospect, it makes sense. Its a feature to conveniently print out
> an array without using join. I wish I had run across this sooner. :(
> I've always been using join.
>
> Bryan Lane wrote:
> >
> > That's interesting. That's not what I expected either.
> >
> > -----Original Message-----
> > From: doug.miles at bpxinternet.com [mailto:doug.miles at bpxinternet.com]
> > Sent: Friday, July 07, 2000 10:49 AM
> > To: Phoenix.pm
> > Subject: Phoenix.pm: Perl 101
> >
> > Thanks to all those who made it out last night. We had a good turnout,
> > and hopefully we'll get some new regulars. To answer a couple of
> > questions from last night (and raise a new question):
> >
> > #!/usr/bin/perl
> >
> > @author = ('Tom', 'Randal', 'Larry');
> > print "@author\n";
> > print @author;
> > print "\n";
> >
> > displays this:
> >
> > Tom Randal Larry
> > TomRandalLarry
> >
> > This surprised me that 'print "@author\n";' interpolates with spaces in
> > between elements. Does anyone know where this is documented? I checked
> > perop, but couldn't seem to find it there.
> >
> > Also, the range operator (..) does not work in reverse, i.e.
> > @author[2..1]. It only works to increment through the range, not
> > decrement.
> >
> > --
> > - Doug
> >
> > Don't anthropomorphize computers. They hate that.
>
> --
> - Doug
>
> Don't anthropomorphize computers. They hate that.
>
View my Brainbench.com transcript
http://www.brainbench.com/transcript.jsp?pid=498286
More information about the Phoenix-pm
mailing list