Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Skipping lines

by boo_radley (Parson)
on Jul 15, 2002 at 21:47 UTC ( [id://181933]=note: print w/replies, xml ) Need Help??


in reply to Skipping lines

here's a short solution that changes the input record separator to 2 newlines, one of my favorite tricks. I also wanted to see if I could get each variable populated with only one split which turned out to be easier than I thought.
use strict; use warnings; { local $/="\n\n"; while (<DATA>) { my (undef, $o, undef, $q, undef, $c, undef, $u) = split /\n|( +?: : )/, $_; print "Usage for object is $u bytes. Quota is $q bytes. Serve +r is lnxdayhome01. Path is $o\n"; } } __DATA__ Object : T:\HD1\UDENTJP Quota : 250000000 Bytes Current : 0 Bytes Used(%) : 0%

Replies are listed 'Best First'.
Re: Re: Skipping lines
by greenFox (Vicar) on Jul 16, 2002 at 01:23 UTC

    No point in grabbing all those values from split and then throwing them away (with undef)-

    my ($o, $q, $c, $u) = (split /\n|(?: : )/, $_)[1,3,5,7];

    --
    Until you've lost your reputation, you never realize what a burden it was or what freedom really is. -Margaret Mitchell

      Thanks all. I removed the line $quota = <QUOTA1>; and lo
      and behold it worked! (I knew I was doing something wrong.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-26 04:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found