[Message Prev][Message
Next][Thread Prev][Thread Next][Message
Index][Thread Index]
Any Perl experts out there?
- Subject: Any Perl experts out there?
- From: John B
- Date: Sun, 14 Dec 2003 15:56:00 +0000
Hi all,
I was wondering if there was anyone who can advise me on how to progress
with
the following:
I have a Perl sub routine for retrieving a parameter from the body of an
xPL
message.
You would call it using something like:
my $param = getparam($xpl_message,"text");
This would place the contents of the text parameter into $param.
However, the routine I've written (pasted below) makes the element names
case
sensitive.
So calling getparam($xpl_msg,"TEXT") will not work if the message
actually
contains "text" (i.e. in lower case).
Any thoughts?
Regards,
John
------------------------
sub getparam {
my $buff = $_[0];
$buff =
substr($buff,index($buff,"}"),length($buff)-index($buff,"}"));
$buff =
substr($buff,index($buff,"{")+2,length($buff)-index($buff,"{")-2);
$buff = substr($buff,0,index($buff,"}")-1);
my %params = map { split /=/, $_, 2 } split /\n/, $buff ;
return $params{$_[1]};
}
xPL Main Index |
xPL Thread Index |
xPL Home |
Archives Home
|