?
Solved

Assigning Shift to a variable

Posted on 2003-03-27
2
Medium Priority
?
165 Views
Last Modified: 2012-05-04
Hi,
I am in the process of learning perl. I came through a piece of code where the shift operator is being assigned to a variable. The code is something like this:

my ($var1) = shift;

I am not quite able to understand what exactly happens here and how this work? Can someone please explain?

Thanks
0
Comment
Question by:akila76
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 100 total points
ID: 8222441
perldoc -f shift
       shift ARRAY

       shift   Shifts the first value of the array off and
               returns it, shortening the array by 1 and moving
               everything down.  If there are no elements in the
               array, returns the undefined value.  If ARRAY is
               omitted, shifts the `@_' array within the lexical
               scope of subroutines and formats, and the `@ARGV'
               array at file scopes or within the lexical scopes
               established by the `eval ''', `BEGIN {}', `INIT
               {}', `CHECK {}', and `END {}' constructs.
0
 

Author Comment

by:akila76
ID: 8222462
Thanks a lot
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question