my $output = `ls -p`; # or get each line into an array my @files = `ls -p1`;