Take input from a file and have each value separated by spaces be put into a variable?

Use strict; use warnings; while() { chomp; next if /^\s*$/; #skip empty lines my($local_port, $license_server, $remote_port, $sh_server, $sh_server_port) = split; print "$local_port\n"; #.... } use as perl my_script. Pl.

Welcome Dan to stackoverflow. #! /usr/bin/perl # ALWAYS declare these two lines use strict; use warnings; my $logPath = '/path/to/logfile'; # use 3 args open and test for failure open my $fh, ') { # delete line separator chomp $line; # split each line on spaces my ($LocalPort, $LicenseServer, $RemotePort, $ShServer, $ShServerpor) = split/\s+/, $line; # do the stuff with the variables } #close the file and test for failure close $fh or die "unable to close '$logPath' : $!

Line = reads the entire file into @line. What you need is something like this: while () { ( $LocalPort, $LicenseServer, $RemotePort,$ShServer,$ShServerpor ) = split (/\s/, $_ ); }.

Thank you might stackoverflow community. I now have the full script and all of its requirements up and running :) This scripting stuff is kind of fun. Thanks again!

– Dan May 10 at 15:51.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions