Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: At each change in...

by stefp (Vicar)
on Jun 13, 2002 at 09:33 UTC ( [id://174125]=note: print w/replies, xml ) Need Help??


in reply to At each change in...

If you want to detect change from one line to another, indeed something like if $foo ne $previousfoo will do.

But detecting the first occurrence of a chain is quite another problem that can be solved by memorizing the number of occurences as value associated to the string:

perl -ne 'chomp; print "new $_\n" unless $a{$_}++' nm_of_processed_fi +le
The loop may have to be explicit depending on the source of your data.

-- stefp -- check out TeXmacs wiki

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-16 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found