http://www.perlmonks.org?node_id=869042


in reply to parsing data in a file

You should be programming defensively here:

my ($fname,$lname) = split(" ",$name);

Instead of that, I'd recommend

# If there are two names separated by a space .. my ($fname,$lname); if ( $name =~ /\w+\s\w+/ ) { # Separate them into first and last names. ($fname,$lname) = split(" ",$name); } else { # Otherwise, decide what to do with just a single name. # Use the name as a last name? Die? Ignore? }
Don't assume that your input's always going to be clean.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds