Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Compare elements of a line in a file

by frozenwithjoy (Curate)
on Sep 13, 2012 at 07:55 UTC ( #993404=note: print w/ replies, xml ) Need Help??


in reply to Compare elements of a line in a file

Here is a start:

perl -E '@coords = qw(1069 126046 126047 126048); map {say if $_ > $la +st+50; $last = $_} @coords' ______ 1069 126046


Comment on Re: Compare elements of a line in a file
Download Code
Re^2: Compare elements of a line in a file
by oxydeepu (Novice) on Sep 13, 2012 at 08:21 UTC

    Thank you for the reply.

    I have these data inside a file. So how am I supposed to format? This code is direct from command line right?

    Thank you
    Deepak

      So, based on the code you posted in response to Dave, you should be able to replace your foreach loop with:
      foreach (sort keys %h) { @n = split /\t/, $h{$_}; map {say if $_ > $last+50; $last = $_} @n; }

        Thank you.

        I will try that snippet.

        Thank you.

        I will try that snippet. If you don't mind can you tell me what does it do?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-12-21 05:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (103 votes), past polls