Fine, it compiles without strict but it has two additional errors.
-
It's not using strict :)
-
Package var $i is used when you intended lexical $i to be used. Why bother declaring lexical $i if you're not going to use it and you're ok with using the (unlocalised!!!) package var? Your code is equivalent to
my %code = map { $_ => $i++ } split /,/, $tokens;
my $i = 0
so you should use the following is you think it's fine
my %code = map { $_ => $i++ } split /,/, $tokens;
| [reply] [d/l] [select] |
Well, I used to write perl 4 code for years, scratching my back with my own nails, because my scripts usually were simple enougth, just regexpr to filter/format some text files.
Few years ago, I started to use modules and OO, just reading some examples from the docs (and sometimes, pm's source code).
Today, I'm just having fun writing some programs for personal use, and learning some advanced tricks to write code where there is no module available.
From my previous posts, you can guess that my favourite module is WWW::Mechanize, and I currently have scripts to download/archive picture galleries from Yahoo Groups and Facebook, videos from Youtube, and such, where I found no modules for that nor free GUIs from someone else. Now I'm trying to split most of my scripts to write standard modules (and possibly publish in CPAN), but I realize that I have much to learn yet.
| [reply] |