Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I see you've already got some good guidance on solving your problem, but I'm still drinking my morning coffee, so I thought I'd chime in with a couple things that may be helpful, even if they're not directly related to your question. Files Two things about your file handling:
So as regarding file I/O, I'd suggest you do it more like this:
As you can see, it's not much more work, but later you'll get the dividends. Regular Expressions You mentioned to choroba that you're not a regex expert, and that's fair. But I'd suggest you dedicate a couple hours to getting a firm handle on the basics. I'd suggest starting by reading perldoc perlrequick to start off, and following it up with the regular expression tutorial (perldoc perlretut). Once you're a bit more comfortable, then perldoc perlre and make sure you totally understand sections "The Basics", "Modifiers", "Quantifiers", "Escape Sequences", "Character Classes", "Capture Groups", and "Combining RE Pieces". You don't need to learn all of the other sections, as there's quite a bit there. But the these sections cover all the most important bits to give you proficiency in regular expressions. You should skim over the other sections, too, but not with the aim of understanding it all at one go. (There's simply too much there to pick up quickly.) Instead, you want to "prime your brain" with a few ideas. That way, when you come across a task that might need an advanced topic, you may remember that there's an advanced regex feature that may be suitable. Be sure to not just read the documentation, though, write some code to play with the features to be sure you get a good handle on them. Regular expressions are one of the centerpieces of Perl and having a good grasp on them will simplify *many* future tasks. ...roboticus When your only tool is a hammer, all problems look like your thumb. In reply to Re: read/write delete duplicates/sort PROBLEM! - Use of uninitialized value in sprintf
by roboticus
|
|