Note that there are some explanatory texts on larger screens.

plurals
  1. POA simple perl program to send data from different files
    primarykey
    data
    text
    <p>I wrote a perl program which send the updated data from a file to remote server periodically. But now i want it to read it from differnt files and send the updated data such that the reciever should know how to seperate the data from the mixed data. Do i just need to put some kind of delimiter? Is there any standards already there for such things?</p> <pre><code>############# #Change parameters ############ $PeerAddr='192.168.0.7'; $PeerPort='7070'; ############## # Import packages ############## use Text::Diff; use IO::Socket; ############# # Define global variables ############# $lineCount=0; $loopCount=0; our $stats2 = 0; for($count = 0; $count &lt;= 10000; $count++){ my $data_dir="archive/otat/*dat"; my $data_file= `ls -t $data_dir | head -1`; chomp($changed_data_file); print "old data_file is $changed_data_file \n"; chomp($data_file); if($data_file ne $changed_data_file){ $lineCount2=0; $changed_data_file=$data_file; print ("String:$data_file :$changed_data_file are not equal\n"); } while(defined($data_file)){ print "$data_file \n"; open (DAT,$data_file) || die("Could not open file! $!"); @iofile = &lt;DAT&gt;; $lineCount = @iofile; splice(@diffLines); print "printing: $lineCount\n"; print "printing 2: $lineCount2 \n"; chomp $lineCount; chomp $lineCount2; if($lineCount != $lineCount2){ $j=0; for($i=$lineCount2;$i &lt;= $lineCount; $i++){ $diffLines[$j] = $iofile[$i]; $j++; } $num=@diffLines; print "count of diff lines:$num\n"; $lineCount2 = $lineCount; $loopCount=0; } if($loopCount&gt;2){ $loopCount=0; print "Look for recent file \n"; last; } $loopCount++; sleep(5); ############################ &amp;socket_con(@diffLines); } } #### Methods/Functions sub socket_con { if ($sock== 0){ $sock = new IO::Socket::INET ( PeerAddr =&gt; $PeerAddr, PeerPort =&gt; $PeerPort, Proto =&gt; 'tcp' ); die "Could not create socket: $!\n" unless $sock; } print $sock @_; #close($sock); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload