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: [tester_V] delete the newest file from the list: Edit Log



Laurent_R
Veteran / Moderator

Nov 18, 2017, 3:01 PM


Views: 15037
Re: [tester_V] delete the newest file from the list


In Reply To
I tried to use Laurent_R code but it fails on line 3 for "use feature "say"; so I removed it.
I replaced "say" with print "@sorted \n " ; and the code really sorts the list.
It just prins everything on the same line and the " \n " did not work somehow.


Yeah, I did not know you were stuck with such an old version of Perl. "say" was introduced with version 5.10 (which came out in 2009).

Try this:

Code
print "$_\n" for @sorted;




In Reply To
I also wanted to remove the newest file from the list that was a major headache for me.

The pop function, used on the @sorted array, will return the last item of the array (newest file) and remove it from the array.

Update: you completely changed your post after I responded to it. My answers now look weird and unrelated to your post.

Update 2: Oh, no, it is actually a new post that you posted. Sorry, our posts sort of crossed each other.


(This post was edited by Laurent_R on Nov 18, 2017, 3:23 PM)


Edit Log:
Post edited by Laurent_R (Veteran) on Nov 18, 2017, 3:12 PM
Post edited by Laurent_R (Veteran) on Nov 18, 2017, 3:23 PM


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

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