in reply to Re^2: Perl beginner's issue with hash
in thread Perl beginner's issue with hash

All I've changed is the 'if' for a 'while' ...

If all you've done is change
    if (CONDITION) { ... } else { ... }
    while (CONDITION) { ... } else { ... }
then yes, this is a syntax error because there is no  while ... else ... statement block structure in Perl. (The only  if statement | statement block I can see in the OPed code is  if (/$id/g) { ... } — is this the one you're referring to?)

I'm not sure what you were trying to accomplish with this change, so I'm not sure what to advise as the proper change.

Give a man a fish:  <%-{-{-{-<