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:28 PM


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


In Reply To
The code works great if it is used with this input:

my @files = qw /
Rbck_flow_log.2017-10-01.1
Rbck_flow_log.2017-10-01.2
Rbck_flow_log.2017-10-01.13
Rbck_flow_log.2017-10-01.4
Rbck_flow_log.2017-10-01.10
Rbck_flow_log.2017-10-01.3
Rbck_flow_log.2017-10-01.12 /;

but if the lines are inside the "Flow.txt" file then the code sorts the lines but produces 2 types of error:

Unsuccessful stat on filename containing newline at...
Use of uninitialized value in numeric comparison (<=>) at C:....

If you're reading your filenames from a file, then you need to use chomp to remove the trailing newline character from the input before you use stat on them.

But, as I said before, I doubt it is a good idea to use stat for your purpose.

BTW, where did you get the idea of using stat from? From your other question, it seems you don't understand what it does.

Did you post on another forum?



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


Edit Log:
Post edited by Laurent_R (Veteran) on Nov 18, 2017, 3:31 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