On Wednesday, June 12, 2002, at 06:39 , David T-G wrote:
[..]
> my # vars we will use
> (
> $m3u, # file name
> $mp3, # disk label
> $source,$host, # where we got it
> $artist,$disk,$track, # the real data :-)
> @allsources, @allhosts, # where we get 'em
> $fullpath, # hash key
> @working, # stripped copy of $fullpath
> %threez, # hash that holds DB record
> ) = "" ;
>
> $m3u = $source = $host = "" ; # what can't be undef
Let's step back and do a quick review here:
things on the left hand side of an "=" that have
a (...) are 'in a list context' - hence they are trying
to deal with things on the right hand side of that as
if they were in a list context:
my ($foo, $bar, @junk) = subThatHandsBackListOfStuff(@arglist);
but you have written your kvetch in the form
<list_context> = <scalar_context>
vice say
my ($foo, $bar, @junk, %hash ) = ( ' ', ' ', (), ());
also as I think we are all agreeing, if your choice of
variable names are not in themselves clear enough, then
opting for the simpler pre-definition form of
my $foo = ''; # you know, for the foo stuff
would seem to be more reasonable.
But i think we all generally agree that it is better to
DO the appropriate scoping for a variable - vice having
a generic stack of them defined 'globally' - and counting
on 'side effect' to change them...
hence you might think of solving the problem with say
while (<>)
{
my ($artist, $album, $track) = split(/\//);
if ( $track ) {
if ( $track eq "foo" )
...
} else {
blowChow("bad record with $artist, $album - missing Track\n");
}
}
OR how about
my $dataStuff = GetRecordsFrom($filename);
Then process that with the
if ( $dataStuff->{'track'} .... )
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]