Andrew Libby on 18 Jan 2006 16:42:44 -0000


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

Re: [PLUG] Perl question...


Hey Eric,

Hand edited file, huh...  Seems like a terrific opportunity for a simple
web app to enforce the data formatting.  Making editing the file and
processing it a lot easier.

For something simple a CGI is a great thing.  For more involved
applications, I've been using Catalyst (http://catalyst.perl.org/) and
have just fallen in love with it.

<alibby:meeting-idea>

Perhaps I'm too much of a programmer type, but I really appreciated
seeing the ruby example.   I think that seeing a few simple problems
solved in Ruby, Python and Perl (with explanations of course) would
make for a pretty interesting meeting.    I fall into the Perl way of
doing things (as if there's just one Perl way...).  But I'm very interested
other high level languages as well.

</alibby:meeting-idea>

Andy

Eric wrote:

>Quoting "Michael C. Toren" <mct@toren.net>:
>
>  
>
>>On Wed, Jan 18, 2006 at 08:30:30AM -0500, Andrew Libby wrote:
>>    
>>
>>>Okay, so if you've got whitespace in your field values, something more
>>>like this might work:
>>>      
>>>
>>It isn't entirely clear to me what the structure of the input file is
>>based on the posts I've seen.  If the issue is that data can be found at
>>predefined column numbers, but that sometimes tab characters are used to
>>jump to the next tab stop, one solution is to simply to have the perl
>>script expand tabs before parsing:
>>
>>	use Text::Tabs
>>
>>	while (my $line = expand <>)
>>	{
>>	    my $data = substr $line, 71, 35;
>>	    ...
>>	}
>>
>>-mct
>>    
>>
>
>I'll admit that one data record is not a good example!
>The input file is manually maintained.  Therefore the person
>sometimes used spaces and sometimes used tabs.  Randomly.  
>
>I liked the regular expression solution on the presumption
>that spaces embedded in the string fields would be singular while
>the fields would be delimited by spaces and/or tabs.  
>As it was, I manually edited the 1166 records by
>searching for tabs and manually cleaning up the columns.
>It took about 15 minutes and I could just "unpack" to my heart's
>content.  Now 'expand' I've never heard of before!  Part of 
>Text::Tabs I see.  Hummmm.....
>
>Thanks
>Eric
>
>
>___________________________________________________________________________
>Philadelphia Linux Users Group         --        http://www.phillylinux.org
>Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
>General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
>
>  
>


-- 
Andrew Libby                                  
alibby@philadelphiariders.com
http://philadelphiariders.com/
Motorcycle Enthusiasm, Philadelphia Style

1999 SV650
1999 Laverda 750S
1996 BMWR1100RS
1981 Moto Guzzi CX100 (in Lemans I clothing)


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug