Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What does "shift" do in $path = shift? (Perl)

Status
Not open for further replies.

sreeni

Member level 1
Member level 1
Joined
May 24, 2006
Messages
35
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,286
Activity points
1,557
It is from a perl script.
$path = shift;

here what is the significance of shift?
 

perl doubt

Shift
Definition
This function takes the leftmost element from the array specified and returns that, reducing the array by one element. When no array is specified, the array of arguments passed to the Perl script, $ARGV, is used if the context is not in a subroutine; otherwise, the array of arguments passed to the subroutine, @_, is used.

The return value is undefined if the array is empty.

So it looks like it's pulling the path out of the command line arguments
 

    sreeni

    Points: 2
    Helpful Answer Positive Rating
Re: perl doubt

Hi cherrytart,

I have tried with and without shift and came to the conclusion that what u said is correct. Thank you for your help
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top