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.)