Re: substr or anything like that

2002-09-05 Thread zanardi2k2
James Edward Gray II wrote: > If you have fixed width values, separated by spaces and with no spaces > in the values, you could use the super simple: > > @list_of_values = split ' ', $fixed_width_line; No, unfortunately i do have spaces in values. Felix suggestion seems the right way to do it

Re: substr or anything like that

2002-09-04 Thread Jeff 'japhy' Pinyan
On Sep 4, zanardi2k2 said: >I extract data from an AS/400 table, and i am not able to get a decent >CSV format. So i have to choose a fixed-width format. Now i have to get >all values. Is there something better than: > >$var1=substr($_, 0, 10) >$var2=substr($_, 11, 16) >$var3=... Sounds like yo

Re: substr or anything like that

2002-09-04 Thread James Edward Gray II
If you have fixed width values, separated by spaces and with no spaces in the values, you could use the super simple: @list_of_values = split ' ', $fixed_width_line; On Wednesday, September 4, 2002, at 11:00 AM, zanardi2k2 wrote: > I started to use perl a couple of months ago in my spare time

Re: substr or anything like that

2002-09-04 Thread Felix Geerinckx
on Wed, 04 Sep 2002 16:00:06 GMT, Zanardi2k2 wrote: > Is there something better than: > > $var1=substr($_, 0, 10) > $var2=substr($_, 11, 16) > $var3=... See perldoc -f pack perldoc -f unpack If you have e.g. the following layout: my $string = "123 456 ABC"; i.