tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: language bindings (fs-independent quotas)



On Mon, Nov 21, 2011 at 10:55 AM, Eric Haszlakiewicz 
<erh%nimenees.com@localhost> wrote:
> On Mon, Nov 21, 2011 at 04:51:51PM +0100, Manuel Bouyer wrote:
>> On Mon, Nov 21, 2011 at 09:47:43AM -0600, Eric Haszlakiewicz wrote:
>> > On Fri, Nov 18, 2011 at 01:15:47PM +0100, Manuel Bouyer wrote:
>> > > On Fri, Nov 18, 2011 at 07:46:21AM +0200, Alan Barrett wrote:
>> > > > Assuming that there's no need to handle fields with embedded spaces,
>> > > > perl's split() function will DTRT.
>> > >
>> > > No, it does not because there are fields that can be empty.
>> >
>> > This seems to work fine for me:
>> >
>> > $ perl -e 'my @x = split(/,/, "a,b,,c"); print "1:$x[0] 2:$x[1] 3:$x[2] 
>> > 4:$x[3]\n";'
>> > 1:a 2:b 3: 4:c
>>
>> Doesn't work for something like:
>> 176       --  432456  500000  500000             3400   25000   25000
>> 177       ++  105464       1       1   none      2173       1       1   none
>
> I could have sworn we were talking about delimited fields, not fixed width
> fields, but now I can't find where that was mentioned.  I guess I must have
> been imagining things. :)
> Obviously, for fixed width fields using split() isn't appropriate.
>
> eric
>

You should probably use substr() for fixed-length stuff in perl.  It's
very fast.


Home | Main Index | Thread Index | Old Index