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

[MacPerl] working with strings



I have an odd problem and I can't quite grok how to get Perl to do what I want.

I'm reading in a file whose data is written in fixed length records.  Fields are
defined within each record.

Lets say there is a field called full_name which is 40 characters long and I've
read it into a variable $full_name.

It looks like "ATKINSON, TINA                     "

What I need to do is:

1) reverse the name parts and
2) have only the first character in upper case

The way I'd think to do it in a traditional language is to find the last
character that isn't whitespace to get the real length of the name, find the
comma, take the characters up to the comma as the last name and the rest, save
the leading space, as the first name.

But there doesn't seem to be that sort of addressability inside strings.

Probably there's a better way to do it.  Can someone suggest it?  Broad hints
are okay.

Thanks

Adam



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch