my $license_cmd = "lmutil lmstat -f $PRODUCT"; my @parsed; open LICENSES, "$license_cmd |" || die "Can't execute ($license_cmd) \n$!\n"; while () { my $data_line = $_; # Post FlexLM Version 7.0 - Find max number of licenses available if ($data_line =~ /Total of (\d+) licenses issued/) { $MAX_LIC = $1; } # Identify the lines of output that contain user license info elsif ($data_line =~ /\, start /) { # Remove leading spaces from the lines $data_line =~ s/^\s+//g; # Remove duplicate data from the lines (web logons) $data_line =~ tr/-//d; # Remove hyphens to remove the duplicate server name $data_line =~ s/(\b\w+\b)(\s*\1)+/$1/g; # Remove duplicate server name print "\n$data_line"; # <-- test results of data changes # Load user name, PID and Start Time into array USAGE_INFO my @USAGE_INFO = ( split)[ 0, 5, 9 ]; $USAGE_INFO[1] =~ s/\D//g; $USAGE_INFO[2] = sprintf "%05s",$USAGE_INFO[2]; push @parsed, \@USAGE_INFO; } } close LICENSES;