in reply to Re^2: Assign scalar to array
in thread Assign scalar to array

First, start by using use strict; use warnings;. You also have extra quotes in $LFILE = "\@arr10"; use strict; would have caught that.

use strict; use warnings; my $LOGFILE12 = '...'; sub GetDecUser { my $LFILE = -e $LOGFILE12 ? \@arr12 : \@arr10; return grep /declared users/, @$LFILE; } print "$_\n" for GetDecUser();