View Single Post
Old 11-07-2011, 08:14 PM   PM User | #2
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,753
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
First, use File::Copy to create the backup file and I'd include a timestamp as part of the filename to maintain a history.

Load your text file into a hash or a HoA (hash of arrays) or a HoH (hash of hashes) where the keys are the hostnames and the values are the licenses. This will make it very easy to separate the assigned and unassigned licenses. Then take one of the unassigned licenses and move it to the assigned group. Then sort the hash and output its data to the file.

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?
FishMonger is offline   Reply With Quote