http://qs321.pair.com?node_id=854945


in reply to uninitialized string variable

You must be running with warnings enabled, which is a good thing, especially if you're reasonably new to Perl. The warning means that a variable that has no value is being used in string context. If you are using Text::CSV to parse the CSV file, it is probably using undef for blank fields. I'd have to look, but I believe there is a parameter to request that Text::CSV uses an empty string $var = ''; instead of $var = undef; for empty columns, which should prevent the warning.

If that doesn't suit you're liking: you can use something like this: $var ||= ''; to replace the undefined value with a blank string, which would also prevent the warning.


They say that time changes things, but you actually have to change them yourself.

—Andy Warhol