Prompt, read from STDIN, read from the keyboard in Perl
文章推薦指數: 80 %
IO::Prompter. This was a very simple solution using only the core language and providing a very simple way to prompt for some input. For more ...
Togglenavigation
PerlMaven
PerlTutorial
Pro
Login
Register
Books
Typekeyword:
Archive
About
Perltutorial
Introduction
InstallingandgettingstartedwithPerl
TheHash-bangline,orhowtomakeaPerlscriptsexecutableonLinux
PerlEditor
HowtogetHelpforPerl?
Perlonthecommandline
CorePerldocumentationandCPANmoduledocumentation
POD-PlainOldDocumentation
DebuggingPerlscripts
Scalars
CommonWarningsandErrormessagesinPerl
Prompt,readfromSTDIN,readfromthekeyboardinPerl
AutomaticstringtonumberconversionorcastinginPerl
Conditionalstatements,usingif,else,elsifinPerl
BooleanvaluesinPerl
Numericaloperators
Stringoperators:concatenation(.),repetition(x)
undef,theinitialvalueandthedefinedfunctionofPerl
StringsinPerl:quoted,interpolatedandescaped
Heredocuments,orhowtocreatemulti-linestringsinPerl
Scalarvariables
ComparingscalarsinPerl
Stringfunctions:length,lc,uc,index,substr
NumberGuessinggame
whileloop
ScopeofvariablesinPerl
Short-circuitinbooleanexpressions
Files
HowtoexitfromaPerlscript?
Standardoutput,standarderrorandcommandlineredirection
Warningwhensomethinggoeswrong
Whatdoesdiedo?
WritingtofileswithPerl
Appendingtofiles
Openandreadfromtextfiles
Don'tOpenFilesintheoldway
ReadingandwritingbinaryfilesinPerl
EOF-EndoffileinPerl
tellhowfarhavewereadafile
seek-movethepositioninthefilehandleinPerl
slurpmode-readingafileinonestep
ListsandArrays
Perlforloopexplainedwithexamples
PerlArrays
Processingcommandlinearguments-@ARGVinPerl
HowtoprocesscommandlineargumentsinPerlusingGetopt::Long
AdvancedusageofGetopt::Longforacceptingcommandlinearguments
Perlsplit-tocutupastringintopieces
HowtoreadaCSVfileusingPerl?
join
Theyearof19100
ScalarandListcontextinPerl,thesizeofanarray
Readingfromafileinscalarandlistcontext
STDINinscalarandlistcontext
SortingarraysinPerl
Sortingmixedstrings
UniquevaluesinanarrayinPerl
ManipulatingPerlarrays:shift,unshift,push,pop
ReversePolishCalculatorinPerlusingastack
UsingaqueueinPerl
Reverseanarray,astringoranumber
TheternaryoperatorinPerl
Loopcontrols:next,last,continue,break
min,max,suminPerlusingList::Util
qw-quoteword
Subroutines
SubroutinesandfunctionsinPerl
PassingmultipleparameterstoafunctioninPerl
VariablenumberofparametersinPerlsubroutines
ReturningmultiplevaluesoralistfromasubroutineinPerl
Understandingrecursivesubroutines-traversingadirectorytree
Hashes
HashesinPerl
CreatingahashfromanarrayinPerl
Perlhashinscalarandlistcontext
exists-checkifakeyexistsinahash
deleteanelementfromahash
HowtosortahashinPerl?
CountthefrequencyofwordsintextusingPerl
RegularExpressions
IntroductiontoRegexesinPerl5
Regexcharacterclasses
Regex:specialcharacterclasses
Perl5RegexQuantifiers
trim-removingleadingandtrailingwhitespaceswithPerl
Perl5RegexCheatsheet
Shellrelatedfunctionality
Whatare-e,-z,-s,-M,-A,-C,-r,-w,-x,-o,-f,-d,-linPerl?
CurrentworkingdirectoryinPerl(cwd,pwd)
RunningexternalprogramsfromPerlwithsystem
qxorbackticks-runningexternalcommandandcapturingtheoutput
Howtoremove,copyorrenameafilewithPerl
Readingthecontentofadirectory
Traversingthefilesystem-usingaqueue
CPAN
DownloadandinstallPerl
InstallingaPerlModulefromCPANonWindows,LinuxandMacOSX
Howtochange@INCtofindPerlmodulesinnon-standardlocations
Howtoaddarelativedirectoryto@INC
ExamplesforusingPerl
HowtoreplaceastringinafilewithPerl
HowtoreadanExcelfileinPerl
HowtocreateanExcelfilewithPerl?
SendingHTMLe-mailusingEmail::Stuffer
Perl/CGIscriptwithApache2
JSONinPerl
SimpleDatabaseaccessusingPerlDBIandSQL
ReadingfromLDAPinPerlusingNet::LDAP
Commonwarningsanderrormessages
Globalsymbolrequiresexplicitpackagename
VariabledeclarationinPerl
Useofuninitializedvalue
BarewordsinPerl
Name"main::x"usedonlyonce:possibletypoat...
Unknownwarningscategory
Can'tusestring(...)asanHASHrefwhile"strictrefs"inuseat...
SymbolicreferencesinPerl
Can'tlocate...in@INC
Scalarfoundwhereoperatorexpected
"my"variablemasksearlierdeclarationinsamescope
Can'tcallmethod...onunblessedreference
Argument...isn'tnumericinnumeric...
Can'tlocateobjectmethod"..."viapackage"1"(perhapsyouforgottoload"1"?)
Uselessuseofhashelementinvoidcontext
Uselessuseofprivatevariableinvoidcontext
readline()onclosedfilehandleinPerl
Possibleprecedenceissuewithcontrolflowoperator
Scalarvalue...betterwrittenas...
substroutsideofstringat...
Haveexceededthemaximumnumberofattempts(1000)toopentempfile/dir
Useofimplicitsplitto@_isdeprecated...
Other
MultidimensionalarraysinPerl
MultidimensionalhashesinPerl
MinimalrequirementtobuildasaneCPANpackage
Statementmodifiers:reversedifstatements
Whatisautovivification?
FormattedprintinginPerlusingprintfandsprintf
Prompt,readfromSTDIN,readfromthekeyboardinPerl
STDIN
chomp
IO::Prompter
Prev
Next
WhengettingstartedwithPerloneofthefirstthingsyouneedto
knowishowtointeractwiththeuseronthecommandline.Inotherwordsyouneedtobeableto
handlebasicInputOutput(I/O).
examples/prompt.pl
usestrict;
usewarnings;
print"Yournameplease:";
my$name=
延伸文章資訊
- 1How to get input from the terminal in Perl - Stack Overflow
I'm taking questions from the terminal and sending reply with dialog, but my program takes only t...
- 2Prompt, read from STDIN, read from the keyboard in Perl
IO::Prompter. This was a very simple solution using only the core language and providing a very s...
- 3精簡扼要的Perl 課程講義(四):標準輸入輸出與檔案輸入輸出
標準輸入輸出. # 標準輸入輸出 # (1) STDIN, STDOUT, STDERR print "Enter your name:"; $input = <STDIN>; # 從STDIN...
- 4Perl Tutorial - User Input - Tizag Tutorials
A tutorial of PERL , standard input in PERL via the command prompt. ... <STDIN> stands for standa...
- 5Perl STDIN | How STDIN works in Perl? with Examples and ...
Perl STDIN is used to get input from standard console by using STDIN in perl. STDIN in perl is al...