(This is my first meditation. I am posting in hopes it will help someone down the line! I can't find another node about this, but that doesn't mean there isn't one :) .)
I needed to run a program and then wait for the user to hit Enter. I tried this:
Not what I expected!$ perl -e 'system(@ARGV); readline' echo foo foo Can't open echo: No such file or directory at -e line 1. Can't open foo: No such file or directory at -e line 1.
After all, perlrun says that:
If -e is given, Perl will not look for a filename in the argument list.
What I was missing is that readline does look at the argument list. Readline:
reads ...from *ARGV if EXPR is not provided
So what I needed was to expressly read from STDIN to get my keypress:
# vvvvv $ perl -e 'system(@ARGV); readline STDIN' echo foo foo (<=== waited here for me to press Enter)
Back to
Meditations