in reply to backtick iterpolation issue
Hello idlehands, and welcome to the Monastery!
As toolic says, you can remove carriage returns with the substitution operator. The transliteration operator is another option:
$result =~ tr/\r//d;
But most likely you don’t need backticks at all: forget ls and just use Perl’s built-in commands. For example, to get a list of all the plain files (but not directories) in directory $dir:
use strict; use warnings; use autodie; use Data::Dump; my $dir = ...; opendir(my $dh, $dir); my @f = grep { -f } readdir($dh); closedir $dh; dd \@f;
See readdir and the file test operators.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|