Unlock all 23 pages
Get it free by sharing your own notes, buy just this one, or become a member and unlock documents with your plan.
How to unlock this document
Choose the way that suits you. Each one gives you all 23 pages to read online and the PDF to download.
Share your notes, unlock for free
2 free unlocks for every 5 approved uploads
- Upload your own lecture notes, assignments, essays or past papers
- PDF, Word, PowerPoint and Excel files all work, and you can send many at once
- We check each upload; you get a notification when it is approved
- Spend a free unlock on this document or any other, and keep it for good
- Shared under your public username, never your email
Then upload your notes from your profile.
Buy this document
$23 one-time payment
- All 23 pages of this document, yours to keep
- Download the PDF and read it any time, also offline
- No subscription and nothing to cancel
- Find it again any time under My Profile → Library
You log in or create a free account first, then pay securely.
Become a member
Unlock documents from the whole library, which keeps growing
- Choose any documents you like, up to your plan’s unlocks
- Documents you unlock stay yours, even if you cancel later
- Your unlocks start again with every renewal
- Secure checkout by Dodo Payments
You log in or create a free account first, then pay securely.
Compare the plansAlready a member, or bought this before? Log in to open it
About this document
- Pages
- 23 pages
- Price
- $23 one-time, yours to keep
- Membership
- Included in every plan
- Format
- Subject
- Computer Science, Programming
This document explains how to run a Perl program, including typing it in a text editor, making it executable, and running it from the command line. It also covers subroutines, parameters, and returning values. It is useful for students learning to program in Perl.
What's inside
- Typing and saving a Perl program
- Making a file executable
- Running a Perl program from the command line
- Handling error messages
- Using subroutines and parameters
- Returning values from subroutines
Who it is for: Students learning to program in Perl. (Undergraduate)
Share with classmates: WhatsApp Telegram X LinkedIn Facebook
Summary
Perl is a programming language. Students learn how to write, run and debug Perl programs.
Running Perl
Use a text editor to write a Perl program. Make the file executable and run it. If errors occur, use warnings or a debugger to find them.
Subroutines and parameters
Subroutines are functions in Perl. They can be placed anywhere but are usually grouped. Parameters are passed as a list to the special @_ array.
Returning values and conditionals
A subroutine's result is its last evaluated value. Conditional statements can have multiple alternatives, using elsif with an 'e' missing.
Text file exercises
Students are given exercises to alter a program. It should count lines with certain strings, using the $_ variable and word boundaries.
Key terms
- Subroutines
- Functions that users define in Perl programs.
- Special variables
- Variables with odd names that have specific uses in Perl.
- @_ array
- The list array variable that holds parameters passed to a subroutine.
- Regular expressions
- Patterns used to match strings in Perl, also for substitutions.
- Associative array
- A Perl data structure that stores key-value pairs.
- Environment variables
- Variables set when running a Perl program, stored in the %ENV array.
Questions this document helps with
- How do you run a Perl program from the command line?
- How can you pass parameters to a Perl subroutine?
- What is the difference between elsif and else in Perl?
Summary written with AI from the document's text.
Ask the AI Teacher
Ask any question about this document or your course, and get a clear explanation.
Log in to ask Create a free account
Free accounts can ask 5 questions a day.