[geeks] One of these days....

alex j avriette avriettea at speakeasy.net
Tue Apr 16 15:48:36 CDT 2002


>>> ($temper,$dummy,$dummy,$windsp,$dummy, $dummy,
>>> $direction,$dummy,$dummy,$dummy,$dummy,$dummy) = split(/ /,$_);
>>
>> hm, yeah. this is perls fault.
>
> Lighten up. It's not perfect but maybe he doesn't know the idioms. No
> one starts out knowing everything but you can get a lot done in Perl
> with just a little knowledge.

Hey. Solaris wont tell me why its installer keeps crashing four minutes 
in. Damn, I knew it. Every time I go to use a Solaris box, 4 minutes 
later, I'm wishing I had used windows instead.

Tell me I wouldnt have gotten ripped a new one for that.

> This is better...
>     ($temper,$windsp,$direction) = (split(/ /,$_))[0,3,6];

depending on the application it might be better to use a hash and a 
slice.

my @fields = qw{ temp windsp dir };
my %hash;
@hash{@fields} = (split / /)[0,3,6];

but ymmv and i'm sure that (hmmm, who was it that chewed me out about my 
perl style?) $somebody will tell me how horrible and unintuitive this is 
as well. ho hum.

alex



More information about the geeks mailing list