LINUX.ORG.RU

Ламерский вопрос про Perl......


0

0

Хочу для начала вывести на экран аргумент командной строки Пытыюсь так : test.pl

#!/usr/bin/perl $arg=$ARGV[0]; print "argument $arg"; <>; - это типа чтобы подождало пока кнопочку не клацну

Запускаю ./test.pl xxx

получаю : Can`t open xxx: No such file or directory at ./test.pl line 4

anonymous

in your case <> tries to read from the default stream which happens to be the last argument you have used
so it acts as if you would have written <$arg>
if you want your program to quit when you hit something like ENTER or CTRL+D
use 
while(<STDIN>){exit if($_);}

anonymous
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.