if (-e "test.txt") { open (my $test, '<', "test.txt") or print "Can't open file: $!"; print "opening file \n"; while ( my $line = <$test> ) { my ($a, $b, $c) = split / /, $line; print "$a, $b, $c \n" ; } }