in reply to trying to format a list
This is a fairly complex task for a "total noob." You need to know how to:
All those topics would be scattered through several chapters of any book on learning Perl, so don't feel bad if you struggle with it for a while. Start at the top of the list and work your way down: learn how to read and write files, how to loop through a file line-by-line, and so on, and you'll get there.
Just for fun, here's a one-liner solution that leverages the Unix sort utility so I don't have to do it in Perl. When you can figure out what this is doing, you won't be a noob anymore.
$ cat 1124577.txt Black, Joe 0987 Smith, Sue 0534 Brown, Andy 587-0986 Galt, John (212)-555-1212 $ perl -ne 'print if s|^(.*\S)\s+(\(\d\d\d\)-)?(\d\d\d-)?(\d\d\d\d)|$1 + . " " . ($2?$2:"(333)-") . ($3?$3:"321-") . $4|e' 1124577.txt | sort Black, Joe (333)-321-0987 Brown, Andy (333)-587-0986 Galt, John (212)-555-1212 Smith, Sue (333)-321-0534
Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.
|
|---|