That –
that you've thankfully copy & pasted is a Unicode en dash character (U+2013) and not the ASCII hyphen character -
(U+002D).
Perl backticks: flags do not exist
Pregunta
When executing the following segment of code,
sub list {
my($self)=@_;
my $file = $self->{P_Dir}."/".$self->{Name};
print `ls –l $file`;
}
I get this error:
ls: cannot access –l: No such file or directory
I am not really sure what is causing that, since if I manually type ls -l into the command line, I do not see that error.
Solución
Otros consejos
Hmmm... It works for me though:
$ cat test.pl
#!/usr/bin/perl -w
use strict;
my $file = "rpm.pl";
print `ls -l $file`;
$ perl test.pl
-rw-r--r-- 1 dheeraj dheeraj 922 2012-10-22 19:56 rpm.pl
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow