Re: [MacPerl-WebCGI] well split!!!

[email protected] Thu, 8 Mar 2001 01:41:21 +0900
Newsgroups perl.macperl.webcgi
Message-ID <v04011702b6cc152f47fb@[211.19.94.253]>
[email protected] wrote:
>It's like I'm trying to learn how to program a box of alphabet
>cereal. You people throw out stuff that's not documented in any of
>the reference material I have.
 I think what the trouble is, you don't understand why they are suggesting
these solutions

>Where do you people find statements like --
>
>   my ($database_id, $category, $variable_name, $price, $description,
>$item_number) = split(/\t/);

Well in the PODs for one,  here's a nice struct which you can see by
looking up localtime() in Shuck:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);

but basically what you're dealing with is a variable so:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
or
(@data) =localtime(time); (an array is just a list of variables)
or
@data {@data} =localtime(time); ( a hash is just two lists of varibles
which reference each other)

are all manefestations of the same principle. Isn't it logical to you that
if you can people an array like this
@array= ("one","two","three");

then the inverse is also true?
 ($one,$two,$three)=@array

Why bother doing it like this?
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
it's easy to see how it works

Why bother doing it like this?
(@data) =localtime(time);
it saves on typing

Why bother doing it like this?
@data {@data} =localtime(time);
you don't have to remember the position  of the data in the array, you can
just call it by name.


> I have numerous books on Perl .........
Actually the books in themselves are only good as guidlines, situations
come up all the time where an exact solution hasn't been written down and
the deeper you go in the tougher these calls get, what _does_ help though
is getting some kind of handle on what you're doing and why.


HTH

Robin