Hi! I've been using Perl for awhile but I still have some doubts :) hopefully you will help me to clarify some concepts :)
In particular, I have the following situation: I have an external command that returns the following: Virtual Disk: 1 Virtual Disk: 6 Virtual Disk: 8 Virtual Disk: 7 Virtual Disk: 5 Virtual Disk: 3 Virtual Disk: 2 Virtual Disk: 4 What I want is to have in a list only the numbers of the virtual disks ( 1, 2, ...., 7, 8). By trial and error, I found that the following code works: my @virtual_disks = sort map { /Virtual Disk:\s(\S+)/ } `$SSCS_CMD list -a $storage vdisk`; my question is, WHY IS THIS WORKING? My first idea was to use this command instead: my @virtual_disks = sort map { s/Virtual Disk:\s(\S+)/$1/ } `$SSCS_CMD list -a $storage vdisk`; but this, for some reason that I don't know, doesn't work, it returns this list (1, 1, 1, 1, 1, 1, 1, 1) instead of (1, 2, 3, 4, 5, 6, 7, 8); can anyone explain me why? Thanks in advance! JP