Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Perl - Remove duplicate based on substring and check on delimiters

by johngg (Canon)
on May 19, 2016 at 11:17 UTC ( [id://1163468]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl - Remove duplicate based on substring and check on delimiters
in thread Perl - Remove duplicate based on substring and check on delimiters

without using substr (which is actually seldom used in Perl)

Surely, you jest?!?!

Cheers,

JohnGG

  • Comment on Re^2: Perl - Remove duplicate based on substring and check on delimiters

Replies are listed 'Best First'.
Re^3: Perl - Remove duplicate based on substring and check on delimiters
by Marshall (Canon) on May 19, 2016 at 23:27 UTC
    Sorry for the controversy - not my intent. I should've said something different or omitted that entirely.

    I use Perl often to process all kinds of text reports. By far and away, the most common tools that I use are: a)split and b)match global combined with c) regex. In my typical application, speed doesn't matter, but flexibility does. It is very seldom that I encounter a fixed column report where substr would be appropriate.

    That doesn't mean that I don't use substr, just that in my personal experience, with the types of text reports that I process, it doesn't come up. Mileage Varies! Processing a binary header, say like that found in a .WAV file is a whole different critter, substr is definately the right tool for that job. I am talking about text reports.

    Just yesterday, a file that I've been processing since 2011 changed its format. Oops. The same info is there, but it got moved around. The 2016 format is different and I have no control over that change. But this change was easy for me to adapt to and was something like this: (split ' ',$line)[1,7,3] to (split ' ',$line)[1,4,-2]. If I had used substr(), then this would have been a bigger deal. Changing something that has been working for 5 years comes up all the time. Such is the nature of using ad hoc methods to parse reports that you have no control over.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1163468]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-19 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found