in reply to Problem undefining a variable in a loop using a module causing a list to not empty after use of a subroutine

I've concentrated on the characters.pl script. This may or may not help, but I'm not getting the errors that I was getting when I first ran it:
#!/usr/bin/perl use strict; use warnings; use diagnostics; foreach my $name (keys my %characters) { my $id = $name; $id =~ s/ /_/g; $id =~ s/[^-\w:.]//g; my $experience = $characters{$name}{'experience'}; my(@classes) = @{$characters{$name}{'classes'};}; print qq[<h1 id="$id">$name</h1>\n]; print "\t<p>" . print_classes($experience, @classes) . "</p>\n"; print "\t<p>Experience: $experience</p>\n"; }
  • Comment on Re: Problem undefining a variable in a loop using a module causing a list to not empty after use of a subroutine
  • Download Code

Replies are listed 'Best First'.
Re^2: Problem undefining a variable in a loop using a module causing a list to not empty after use of a subroutine
by Lady_Aleena (Priest) on Apr 07, 2010 at 06:59 UTC

    I am sorry to say that I can not see the difference other than you putting @classes in parentheses, but it may be that I am tired. Though on the same line there are two semi-colons, one before the closing bracket and one after. Did you want that semi-colon there?

    Have a nice day!
    Lady Aleena