if (...) { # you declare a variable here my $copy; ... # use it here } # and use it here - WRONG