go ahead... be a heretic | |
PerlMonks |
Re: A problem with variables inside a system() callby jarich (Curate) |
on May 14, 2004 at 01:51 UTC ( [id://353251]=note: print w/replies, xml ) | Need Help?? |
Do you get the same kind of error if you rewrite your statement?
Using this extra variable corrects some issues with your here document and should make the code much more readable. Does it also fix the error? I would be intersted in knowing how it's going wrong in the first place... do you have a code example that reproduces the error reliably? One final thing. In some responses above you suggest you will use system instead. I'm sure you know the difference between using backticks and system, but I thought I should point it out anyway. system returns $? which you can use to determine success or failure (basically if it's true your command failed). If the command called via system prints to STDOUT then that content will go to the STDOUT of your program. Backticks capture the STDOUT from the command and return that. If you call backticks in a list context each new line of data is returned in each list element. If you call it in scalar context you get a string with embedded newlines. If you want to give up on backticks but still capture the output of the command then perhaps you might want to use:
I hope this helps jarich
In Section
Seekers of Perl Wisdom
|
|