Dharshana Eswaran wrote:
Hi All,
I am trying to extract few strings from a text file. The pattern of
the text
stored in the file is as follows:
#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01)
/* @LOG
MNSS_MESSAGE_T */
I need to extract MNSS_FACILITY_IND_ID, TF_MNSS_ME
Gregory Machin wrote:
$row =
"CLIENT_LIST,tsc-odi.vpn.ct-net.org,165.146.60.29:11134,10.1.0.46,1959761,218729,Wed
May 16 11:24:37 2007,1179307477"
$row =
~/(\w+)\,(\w+)\,(\d+\.\d+\.\d+\.\d+\:\d+)\,(\d+\.\d+\.\d+\.\d+)\,(\d+)\,(\d+)\,\,(\d+)/
print "info $1 \n";
print "hostname $2 \n";
prin
Unf. Got the picture! I'll spend my night in the stockades :)
-m
Rob Dixon wrote:
Matthew J. Avitable wrote:
Given the original string ...
my $test =
'NAS-IP-Address = 192.168.42.1
...
Acct-Unique-Session-Id = "87d380e1881d226c"
Timestamp = 1177282824
Given the original string ...
my $test =
'NAS-IP-Address = 192.168.42.1
...
Acct-Unique-Session-Id = "87d380e1881d226c"
Timestamp = 1177282824';
You could also invoke perl 5.8's ability to treat an in-memory string as
a file:
## get a filehandle on $test
open(my $fh, '<', \$test
Pierre,
Thank you, but I got it to work the way I wanted, thanks to Matthew and
Rob's posts:
map { modify_variable(${$_}) } = \($var1, $var2, $var3);
To annotate to what Paul said - the above won't work. The block syntax
of map is "map BLOCK LIST". Plus, it looks like you are going to
Hi Pierre,
my @tmp = ( $var1, $var2, $var3 );
@tmp = map modify_variable, @tmp;
which is better
Conway (in Perl Best Practices) prefers the block form of map, since in
his opinion, it's more readable. So you could rewrite it as:
my @tmp = ( $var1, $var2, $var3 );
@tmp = map { modify_variab