#!/usr/bin/perl #udpclient.pl use IO::Socket; use warnings; use Time::HiRes qw (sleep); my ($socket,$data); #my $in_file_name = $ARGV[0]; $in_file_name='C:\Users\Aryan Sinha\Documents\RecordedData.csv'; open(INFILE,"<",$in_file_name) or die "Not able to open test file $!"; $socket = IO::Socket::INET->new (PeerAddr => '21.22.32.214', PeerPort => 5005, Type => SOCK_DGRAM, Proto => 'udp') or die "ERROR in Socket Creation : $!\n"; while () { chomp; if($. != 1) #skip first line { $data=$_; # Data would be in String format my @tempData = split(',', $data); #---------------Description of the problem -------------------------- # 1) I have a CSV File of numeric values which I need to send line by line . # 2) $data has a single line of values in String format . Example : '2,3.4,2323.23,980.3,235.1' # 3) @tempData is an Numeric array where I stored the values spliited from $data . Example : (2,3.4,2323.23,980.3,235.1) # # 4) Now importantly , I need to send the data as a "packet of Numeric values" at a time using SEND SOCKET command in PERL.The Order of Values should not be changed # #-----------------End of the Description ------------------------------ $socket->send($DATA_to_be_SENT); sleep(0.25); } } $socket->close();