# Both connections are telnet based sub getDataFromDevice { # login to the device # define the read/write commands &dumpData($conn, \%cmds) } sub getDataFromJtag { # login to the device # define the read/write commands &dumpData($conn, \%cmds) } sub dumpData { my $conn = shift; my $cmds = shift; my $addr = qr/^\s*0?x?[[:xdigit:]]{8}:\s+0?x?([[:xdigit:]]{8}).*$/; @output = $conn->cmd("$cmd->{read} 0xfeedbeef"); push @obuf, (grep {s/$addr/$1/} @out); }