|Pathologically Eclectic Rubbish Lister|
Re: creating a username from a csv fileby Tanktalus (Canon)
|on Oct 04, 2012 at 22:34 UTC||Need Help??|
Oh, where to start.
First off, you have both open FILE and open my $fh. Stick to one style. Specifically the latter. Yes, it's a minor nit normally, but it got promoted to a major nit (if not, at least a lieutenant nit) by virtue of inconsistency. Also, you don't check the first open's return - stick the "or die" in there as well. (Again, a lieutenant nit for the same reason.)
Second, parsing CSV files without Text::CSV_XS. Not a capital crime, but maybe a minor bit of flogging. (Personally, I prefer DBD::CSV, but it uses Text::CSV_XS under the covers, so I save my back from the flogging that way.)
Next, your assignment to all those variables. When I'm doing a massive split like this, I like to use a hash instead of an array. Or individually-named variables:
Again, this is just a nit, not a problem.
You didn't quite show us what you were trying, only alluded to it and gave us context. But the function you're looking for is substr.
Though I have to wonder about anyone using ssn's for anything other than taxes. Seems like a privacy invasion.