in reply to foreach/while loop help

And, aside from the other good advice above, you should add 'use strict;' after the shebang line ('#!/usr/bin/perl').

Replies are listed 'Best First'.
Re^2: foreach/while loop help
by bshah (Novice) on Jul 13, 2015 at 22:13 UTC

    Thank you for your valuable suggestions.

    I found the issue. When I open the file handle, I did close it so when it looked for the 2nd element from the list, there was nothing to match.
    Thank you again.