Problems? Is your data what you think it is? | |
PerlMonks |
Re: Determining if a program was run from a command prompt.by demerphq (Chancellor) |
on Apr 12, 2006 at 16:11 UTC ( [id://542867]=note: print w/replies, xml ) | Need Help?? |
UPDATE: Bah. This doesnt work. Never mind me. For some reason when you click on the script it gets executed from a console, so the -t tests says true. Wheras if i launch a script from my editor it shows false, so I assumed the same would be true when double-clicking. I shouldnt have assumed..... :-( Sure, use the -t filetest operation to test if STDIN is connected to a TTY. Try the following script (you might have to change where the log gets written to.)
--- $world=~s/war/peace/g
In Section
Seekers of Perl Wisdom
|
|