Re: [問題] activePerl -e 的使用

看板Perl作者 (吃喝玩樂滿天下)時間18年前 (2007/01/26 07:57), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《dipin (吃喝玩樂滿天下)》之銘言: : 我裝了ActivePerl之後 開始寫了一些程式 : 一切都還滿順的 : 可是寫了一陣子之後 想試試-e這個指令 : 卻沒辦法用 : 像是我在命令提示的視窗裡,perl的目錄打入 : C:\Perl\perl -e 'print "Hello Perl !!\n";' : 會顯示 : Can't find string terminator "'" anywhere before EOF at -e line 1. : 請問是出了什麼問題呢? 找到解答了!! \^o^/ 在activePerl所附的說明裡有說到: Why doesn't 'perl -e' work? It does - it's just that some command shells (for example COMMAND.COM, CMD.EXE and 4DOS) don't accept single quotes wrapped around command arguments. The safest way to do perl one-liners is to wrap the parameters within "" (double-quotes) ,then use q() and qq() inside the parameters. q() and qq() with put whatever is inside them between single-quotes or double-quotes, respectively. For example: perl -e "use LWP::Simple; while(@c = head <>) { $c = join qq(\n\t), @c; print qq(Header info:\n\t$c\n); }" (this was all one line) Run this from the command line and type in the URL to your favorite website, like http://www.perl.com/. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 76.171.92.173
文章代碼(AID): #15kKFdph (Perl)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
文章代碼(AID): #15kKFdph (Perl)