Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Newline Delimited Input

by CukiMnstr (Deacon)
on Jun 10, 2003 at 23:53 UTC ( #264905=note: print w/replies, xml ) Need Help??


in reply to Newline Delimited Input

well, as boo_radley already pointed out,
@parts = <IN>;
reads the newline delimited file into the @parts array. The only thing I can think of that might be giving you trouble is that every line in @parts has a newline at the end, but I have no way of telling if this is the problem without seeing the part you took out... does changing the above line to
chomp ( @parts = <IN> );
fixes your problem?

hope this helps,

Replies are listed 'Best First'.
Re: Re: Newline Delimited Input
by Anonymous Monk on Jun 11, 2003 at 05:07 UTC
    Here is the part I took out:
    #Displays total size of specified path (total includes subfolders) foreach my $dir (@parts) { my $total; print "\nWalking $dir\n"; find(sub { $total += -s }, $dir); $total = ($total / 1024) / 1024; $total = sprintf("%0.2f", $total); print OUT "$dir, $total, mb, \n"; } print "\n\tOutput created.\n"; close(OUT);
      so you are not chomp()ing $dir... are you getting something like
      Unsuccessful stat on filename containing newline at...
      when you run your script? Did you try chomp()ing the filenames as I suggest here?

      hope this helps,

        Thanks for your help!! Adding chomp ( @parts = <IN> ); got everything working correctly.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://264905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2020-02-26 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (117 votes). Check out past polls.

    Notices?