DarinGowan
Technical User
How do I prevent perl from concatenating a value?
I am parsing out multiple variable=vaule from a long string (array). One of those variable=value pairs is something like this "origin=aaa.bbb.ccc.ddd" (yep, it's an IP address).
Here is a snipit of my program:
==========================================================
# for each element in the array
while ($data = shift @EVENTDATA) {
# look for specific items, then "set" the variable to it's value
elsif (index($data,'origin=') == 0) {
eval("\$" . "$data" ;
}
}
The eval statement (should) translate to the following:
$origin=aaa.bbb.ccc.ddd
However, when I print my line of data, the IP address comes out like this:
aaa.bbbccc.ddd
Ergo my question "How do I prevent perl from concatenating a value?"
Thank you.
Darin Gowan
I am parsing out multiple variable=vaule from a long string (array). One of those variable=value pairs is something like this "origin=aaa.bbb.ccc.ddd" (yep, it's an IP address).
Here is a snipit of my program:
==========================================================
# for each element in the array
while ($data = shift @EVENTDATA) {
# look for specific items, then "set" the variable to it's value
elsif (index($data,'origin=') == 0) {
eval("\$" . "$data" ;
}
}
The eval statement (should) translate to the following:
$origin=aaa.bbb.ccc.ddd
However, when I print my line of data, the IP address comes out like this:
aaa.bbbccc.ddd
Ergo my question "How do I prevent perl from concatenating a value?"
Thank you.
Darin Gowan