in reply to read/write delete duplicates/sort PROBLEM! - Use of uninitialized value in sprintf

m/<x id=(\d*)([[:alpha:]]*)>/ does not match <tagid=...>. If I change the regex to m/<tagid=(\d*)([[:alpha:]]*)>/, it works.

You should only use most of the Variables related to regular expressions like $1 and $2 if the match was successful, in other words:

if ( $tag =~ m/<tagid=(\d*)([[:alpha:]]*)>/ ) { $tags{sprintf("%04d%6s",$1 || 999,$2)} = $tag; } else { warn "Failed to match: $tag" }
  • Comment on Re: read/write delete duplicates/sort PROBLEM! - Use of uninitialized value in sprintf
  • Select or Download Code

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.