Hi, all -- I'm trying to be good and so I use "my $variable" rather than making them global, and I prefer to not stick little [potentially-confusing] "my" declarations around through the code so I declare my vars up front. While some of them might usefully be pre-filled, many of them can happily by left declared but undefined, so things like
my $foo, $bar, $baz ;
my ($foo, $bar, $baz) = "" ;
work nicely. I haven't yet figured out, though, all of the rules for
arrays and hashes. In my current script, I have
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
with the second line since those vars cause problems later if they are
undefined (even though I set the vars to empty at declaration time just
above) and, more importantly, have to put the hash at the end or I get an
"odd number of elements added to hash" error.
Since the code is meant to be clear and self-documenting, I don't have to
have all of those comments on the right, and would prefer to just have a
nice, polite "my" line listing everything and being done with it. Is
there any way to mix all of these together?
TIA & HAND
:-D
--
David T-G * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
msg25950/pgp00000.pgp
Description: PGP signature
