What are special variables in Perl? - Educative.io
文章推薦指數: 80 %
These special variables are usually represented by using punctuation symbols right after a variable indicator. Variable indicators in Perl include $ , @ ... SolutionsEducativeEnterpriseEnablementplatformDevelopersLearnnewtechnologiesProductsCoursesforEnterpriseSuperchargeyourengineeringteamCoursesforIndividualsWorldclasscoursesOnboardingOnboardnewhiresfasterAssessmentsMeasureyourSkillScorePersonalizedLearningPlansPersonalizedPlansforyourgoalsProjectsBuildrealworldapplicationsAnswersTrustedAnswerstoDeveloperQuestionsPricingForEnterpriseTailoredforyourteamForIndividualsStayaheadofthecurveCoursesLogInJoin forfreeTrustedanswerstodeveloperquestionsTrustedAnswerstoDeveloperQuestionsRelatedTagsperlWhatarespecialvariablesinPerl?ShezaMunirGrokkingModernSystemDesignInterviewforEngineers&ManagersAceyourSystemDesignInterviewandtakeyourcareertothenextlevel.LearntohandlethedesignofapplicationslikeNetflix,Quora,Facebook,Uber,andmanymoreina45-mininterview.LearntheRESHADEDframeworkforarchitectingweb-scaleapplicationsbydeterminingrequirements,constraints,andassumptionsbeforedivingintoastep-by-stepdesignprocess. StartLearningThereareparticularlyreservedkeywordsforspecialvariablesinPerl.Thesekeywordshavepredefinedmeanings. Representation Thesespecialvariablesareusuallyrepresentedbyusingpunctuationsymbolsrightafteravariableindicator.VariableindicatorsinPerlinclude$,@,and%.Anexampleofadeclarationofaspecialvariablewouldbe$_. Examples FollowingaresomeexamplesofspecialvariablesinPerl: $_Thisvariablesearchesforapattern.$/Thisvariableputsanewlineintheinput.Itiscalledthe'inputrecordseparator'$\Thisvariableputsanewlineintheoutputprinted.Itiscalledthe'outputrecordseparator'$"Thisvariableseparatesthevaluesinalist.$0ThisvaluestoresthenameofthefilecontainingtherunningPerlcode.%SIGThisvariablerepresentsthehashusedtosetsignalhandlersformanysignals@ARGVThisvariablestoresanarraycontainingCLIargumentsrequiredinthecode.Code ThefollowingcodeoutlinestheuseofspecialvariablesinPerl: #thiscodeexampleshowsthespecialvariables$_and$/foreach('This','is','an','Edpresso','shot.'){#the'$_'specialvariablecanbeusedtoiterateoveralist(pattern)print$_;#the'$/'specialvariablecanbeusedtoputanewlineprint$/;}RunRELATEDTAGSperlCONTRIBUTORShezaMunirCopyright©2022Educative,Inc.AllrightsreservedGrokkingModernSystemDesignInterviewforEngineers&ManagersAceyourSystemDesignInterviewandtakeyourcareertothenextlevel.LearntohandlethedesignofapplicationslikeNetflix,Quora,Facebook,Uber,andmanymoreina45-mininterview.LearntheRESHADEDframeworkforarchitectingweb-scaleapplicationsbydeterminingrequirements,constraints,andassumptionsbeforedivingintoastep-by-stepdesignprocess. StartLearningKeepExploringRelatedCoursesLearnin-demandtechskillsinhalfthetimeSOLUTIONSForEnterpriseForIndividualsForHR&ducativeSessionsEducativeAnswersABOUTUSOurTeamCareersHiringFrequentlyAskedQuestionsContactUsPressMOREGitHubStudentsScholarshipCourseCatalogEarlyAccessCoursesEarnReferralCreditsCodingInterview.comCopyright©2022Educative,Inc.Allrightsreserved.
延伸文章資訊
- 1Special Variables - Perl 101
Perl has rich signal handling capabilities; using the %SIG variable, you can make any subroutine ...
- 2Special Variables - PERL - kichwa.com
$], The first part of the string printed out when you say perl -v. It can be used to determine at...
- 3Perl Special Variables - CodesCracker
Special variables are predefined having special meaning in perl. The special variables in perl, u...
- 4Special variables in Perl - GeeksforGeeks
Special Variables in Perl are those which are already defined to carry out a specific function wh...
- 5Perl's Special Variables
One of the best ways to make your Perl code look more like … well, like Perl code – and not like ...