Hi again --

...and then David T-G said...
% 
% 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.

I wasn't terribly clear here...  At the moment my program is such a small
script that it doesn't have any subroutines, so it's OK that the way I'm
declaring things looks pretty global.  As it gets fleshed out, though,
the vars will be more properly scoped.  Really, I promise!


% 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) = "" ;
...
%   my                                          # vars we will use
%     (
%     $m3u,                                             # file name
%     $mp3,                                             # disk label
...

Here's where I learned a lot :-)  Not only do the first to one-line
commands not do what I think they did, it logically follows that the
extended command doesn't do what I think (thought!) it did, and that
explains the errors I was getting.

So, to sum up, 

  my ($foo, $bar, $baz)

will declare three variables in a new scope, while to assign data to them
I'll need the not-so-pretty

  my ($a, $b, ... $n) = ('', '', ... '')

and so, overall, it's probably best to just

  my $foo ;
  my $bar = "" ;
  my @baz ;
  my %qux = () ;

and be explicit about it anyway.


Thanks, all!

:-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!

Attachment: msg25968/pgp00000.pgp
Description: PGP signature

Reply via email to