go ahead... be a heretic | |
PerlMonks |
Re: system call errorby marto (Cardinal) |
on Apr 11, 2020 at 12:57 UTC ( [id://11115375]=note: print w/replies, xml ) | Need Help?? |
Your code doesn't do what you think it does. See Why can't I get the output of a command with system()?. Tutorials->Getting Started with Perl/Basic debugging checklist. Basic debugging could have simply been printing the values before you used them. In the chatterbox Corion provided you with a solution reporting the command actually being run on failure. Adding:
generates:
Rather than just:
You code doesn't cater for all use cases, e.g. if there's a sub directory:
You should consider not shelling out and just using perl to handle this, opendir, readdir, grep, or modules like Path::Tiny which provide simpler ways of doing this. Update: for completeness, the only line of code offered in the chatterbox was: system("readelf -sW $var | awk '{print \$NF}'");
In Section
Seekers of Perl Wisdom
|
|