Home arrow Perl Programming arrow Understanding Perl's Special Variables

Understanding Perl's Special Variables

Perl comes with a whole bunch of cryptically-named built-invariables, which clever Perl programmers exploit to reduce the number oflines of code in their scripts. This article examines some of the morecommonly-used special variable in Perl, with examples and illustrations ofhow they may be used.

TABLE OF CONTENTS:
  1. Understanding Perl's Special Variables
  2. In Default
  3. Input...
  4. ...And Output
  5. Getting Into An Argument
  6. The Right Path
  7. To Err Is Human
  8. A Question Of Ownership
  9. Rank And File
  10. Calling For A Translator
  11. End Zone
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 38
July 10, 2003

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

You may find this hard to believe, but the Practical Extraction and Reporting Language, affectionately referred to as Perl by thousands of developers worldwide, was born primarily because its creator needed a tool to generate reports from raw text data. Over the years, though, Perl has grown from strength to strength; today, while it still boasts a very complete (and very impressive) text manipulation API, it can also be used to talk to databases, parse XML, execute SSL transactions and perform a wide variety of other (arcane?) functions.

Now, for newbie Perl programmers, one of the chief obstacles they have to overcome is the somewhat hard-to-understand shorthand used by experienced developers. This shorthand usually takes the form of built-in variables - my personal favourite is @_ though at one time I remember a particular fondness for $? - which have special meaning to the Perl interpreter and which, correctly used, can save you quite a few lines of code in your Perl program. Here, then, is a guide to the more interesting and commonly-used special variables in Perl, together with examples that demonstrate how they may be used.



 
 
>>> More Perl Programming Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PERL PROGRAMMING ARTICLES

- Perl Turns 25
- Lists and Arguments in Perl
- Variables and Arguments in Perl
- Understanding Scope and Packages in Perl
- Arguments and Return Values in Perl
- Invoking Perl Subroutines and Functions
- Subroutines and Functions in Perl
- Perl Basics: Writing and Debugging Programs
- Structure and Statements in Perl
- First Steps in Perl
- Completing Regular Expression Basics
- Modifiers, Boundaries, and Regular Expressio...
- Quantifiers and Other Regular Expression Bas...
- Parsing and Regular Expression Basics
- Hash Functions

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: