CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Beastie] umm...: Edit Log



KevinR
Veteran


Apr 11, 2009, 9:12 AM


Views: 2017
Re: [Beastie] umm...


Quote
Yes, but where do you add in the "/" before the names of the directories under root? I just didn't see any other way to do that except a loop.


If you have an array and wanted to add a / to the front of each element:


Code
$_ = "/$_" for @arrray;



Quote
Shift removes the first element of an array. This isn't a big deal, because that element is in $_, so I can still use it, but there is no need to keep storing it after that point.


Lets look at what happens


Code
@array = (1 .. 10); 

foreach (@array) {
shift(@array);
print;
}


Note what gets printed: 13579
-------------------------------------------------


(This post was edited by KevinR on Apr 11, 2009, 9:12 AM)


Edit Log:
Post edited by KevinR (Veteran) on Apr 11, 2009, 9:12 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives