Hello guys, im a newbie at Perl, my apologies if I ask something that is weird.
Im having a trouble here for an exam, it requires me to use this input:
Slot Description HW Version Software Version Uptime
0 CAM (0D, 12U) CAM-01122W/K04 CMTS_V07.03.01.39 112 days 2:26:
+09
1 CAM (0D, 12U) CAM-01122W/K04 CMTS_V07.03.01.39 112 days 2:26:
+09
2 CAM (0D, 12U) CAM-01122W/K04 CMTS_V07.03.01.39 112 days 2:26:
+09
3 CAM (0D, 12U) CAM-01122W/K04 CMTS_V07.03.01.39 112 days 2:26:
+10
4 CAM (0D, 12U) CAM-01122W/K05 CMTS_V07.03.01.39 112 days 2:26:
+10
5 CAM (0D, 12U) CAM-01122W/K04 CMTS_V07.03.01.39 112 days 2:26:
+09
6 CAM (0D, 12U) CAM-01122W/K04 CMTS_V07.03.01.39 112 days 2:26:
+10
Press <space> to continue, <cr> to single step, ? for help
7 CAM (0D, 12U) CAM-01122W/K05 CMTS_V07.03.01.39 112 days 2:26:
+09
8 CAM (0D, 12U) CAM-01122W/K05 CMTS_V07.03.01.39 112 days 2:26:
+10
9 CAM (0D, 12U) CAM-01122W/K05 CMTS_V07.03.01.39 112 days 2:26:
+10
10 CAM (16D, 0U) CAM-20016W/G04 CMTS_V07.03.01.39 112 days 2:29:
+46
11 CAM (16D, 0U) CAM-20016W/G04 CMTS_V07.03.01.39 112 days 2:30:
+15
12 CAM (16D, 0U) CAM-20016W/G04 CMTS_V07.03.01.39 112 days 2:29:
+51
13 CAM (16D, 0U) CAM-20016W/G04 CMTS_V07.03.01.39 112 days 2:29:
+33
14 CAM (16D, 0U) CAM-20016W/G04 CMTS_V07.03.01.39 112 days 2:29:
+47
15 CAM (16D, 0U) CAM-20016W/G04 CMTS_V07.03.01.39 112 days 2:29:
+52
Press <space> to continue, <cr> to single step, ? for help
17 RCM A RCM-01000W/E04 CMTS_V07.03.01.39 112 days 2:29:
+24
18 RCM B RCM-01000W/E04 CMTS_V07.03.01.39 112 days 2:28:
+22
19 SCM A SCM-02440W/B10 CMTS_V07.03.01.39 112 days 2:32:
+51
20 SCM B SCM-02440W/B10 CMTS_V07.03.01.39 112 days 2:32:
+51
and output the following structure:
my %slotHash = (
"9" = (
type => "CAM", #The first three characters of the descr
+iption
slotID => 9,
description => "CAM (0D, 12U)",
hwVersion => "CAM-01122W/K05",
swVersion => "CMTS_V07.03.01.39",
uptime => 9685570
),
"17" = (
type => "RCM", #The first three characters of the descr
+iption
slotID => 17,
description => "RCM A",
hwVersion => "RCM-01000W/E04",
swVersion => "CMTS_V07.03.01.39",
uptime => 9685764
),
);
Can you guys point me in the right direction?
Im having problems how to declare a hash like this, this input is weird, maybe I can change the input to a delimiter or something, if I do this, how can I do the hash with this specific structure?
THANKS!