If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Your substitution regex is using $ENV{'ComputerName'} and implies that the script will be run on the laptop instead of the deployment server, which doesn't make sense. Where is the laptop hostname coming from?

This definitely helps, especially as it lets me see duplicates easily.

Ideally, I'd like to be able to assign one of the licenses marked 'UNASSIGNED' to the machine that I'm building, then either A) change the one line of the original file, or B) use the move function of File::Copy to move the original file to be the backup and write out the hash (with the change) into a new file.

For example:

Code:

UNASSIGNED 1111-1111-1111-1111

becomes

Code:

WPDONCND12038CJ7 1111-1111-1111-1111

That's what I was trying to do with my original code:

Code:

while ($setCount == 0){
if ($line =~ m/$strSearchFor/){ #this line would look for the word UNASSIGNED
$line =~ s/$strSearchFor/$ENV{'ComputerName'}/i; #this line would replacethe word UNASSIGNED with the current machine name
$setCount = 1;
print LICENSE ($line);
}

Once you load the "license" file into the hash, you would add a new key (which is the hostname of the laptop) and its value is taken/extracted from one of the values of the anonymous array of the "unassigned" key.

Once you load the "license" file into the hash, you would add a new key (which is the hostname of the laptop) and its value is taken/extracted from one of the values of the anonymous array of the "unassigned" key.

So, the data has 2 unassigned licenses, and the script finds the first one and assigns it (which is what's supposed to happen) but how do I get the actual data from the hash for the license keys as opposed to the array reference (that's the hex assignment of where the key is in the array, right?)