I have the following lines of code in a perl file:
@arr1 = grep(/"$subslots_det[0]"/,@grepped_int);
for ur reference the @grepped_int array's dump looks like this:
$VAR1 = [
'GigabitEthernet4/2/1 unassigned YES NVRAM administratively down down ',
'GigabitEthernet7/1 unassigned YES NVRAM administratively down down ',
'GigabitEthernet7/2 unassigned YES NVRAM administratively down down ',
]
Here lets assume, $subslots_det[0] = "4/2";
So the grep statement should match:
GigabitEthernet4/2/1 unassigned YES NVRAM administratively down down ',
Right now it doesnt not do that,iam suspecting it is because of the forward slash in 4/2. Is there a way i can escape the forward slash in the following command:
@arr1 = grep(/"$subslots_det[0]"/,@grepped_int);