It might be simple logic for someone ,but for me its not.So please bare with me.
Please consider array with 14 records .In FOR loop want to Add wait condition of (10sec), if my array count reach 10 push record(10)to print and then wait for 10sec and then push only remaining 4 records to print.Now i am just displaying all records in one shot.Below is my code with json

#!/usr/bin/env perl use warnings; use strict; use Data::Dumper; binmode STDOUT, ":utf8"; use utf8; use JSON; my @records; my $json; { local $/; open my $fh, "<", "reddataout.json"; $json = <$fh>; close $fh; } @records = @{decode_json($json)}; #sort the array @records and assign line number # @records = sort{ $b->{event_age} <=> $a->{event_age} } @records; for my $i (0 .. $#records) { $records[$i]->{line} = $i + 1; } #End# print Dumper \@records;

reddataout.json

[{"ticketnum":"123","event_age":1,"visible":"Yes"},{"ticketnum":"32"," +event_age":2,"visible":"Yes"},{"ticketnum":"98","event_age":3,"visibl +e":"Yes"},{"ticketnum":"45","event_age":4,"visible":"Yes"},{"ticketnu +m":"65","event_age":5,"visible":"Yes"},{"ticketnum":"67","event_age": +6,"visible":"Yes"},{"ticketnum":"56","event_age":7,"visible":"Yes"},{ +"ticketnum":"123","event_age":8,"visible":"Yes"},{"ticketnum":"123"," +event_age":9,"visible":"Yes"},{"ticketnum":"09","event_age":10,"visib +le":"Yes"},{"ticketnum":"16","event_age":11,"visible":"Yes"},{"ticket +num":"32","event_age":12,"visible":"Yes"},{"ticketnum":"123","event_a +ge":13,"visible":"Yes"},{"ticketnum":"123","event_age":14,"visible":" +Yes"}]

Thank you


In reply to Break Array loop by snehit.ar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.