The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Any Perl experts out there?


  • Subject: Re: Any Perl experts out there?
  • From: Stuart Poulton
  • Date: Sun, 14 Dec 2003 21:17:00 +0000

John,

My initial thoughts would be to force both passed stings into lower case
using lc.

A simple example as follows

$test = "Noble";
$test = lc($test);
print "$test\n";

Regards

Stuart



----- Original Message -----
From: "John B" <<a
href="/group/ukha_xpl/post?postID=rjiBhK9l57T8K8cefuQT1JDZ7VKkZ5GYZutziF_kRoDK54GPoys4TbuBqcY-ua6aYzZFdJ23bMK0-Oz2prPHrI1HOdWPKw">home-automation@j...</a>>
To: <<a
href="/group/ukha_xpl/post?postID=g6GWIB2VUUtu_B4PWGFP58A-xqdEYXvtfOHqFP_DAYApzNXI-v1bg444Ad3TpopdRFuCfzarZRdy4XYbqJPSDq0">ukha_xpl@xxxxxxx</a>>
Sent: Sunday, December 14, 2003 3:56 PM
Subject: [ukha_xpl] Any Perl experts out there?


> 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 Links: <a href="http://www.xplproject.org.uk";>http://www.xplproject.org.uk</a>
<a href="http://www.xplhal.com";>http://www.xplhal.com</a>
<a href="http://www.xpl.myby.co.uk";>http://www.xpl.myby.co.uk</a>
> To Post a Message: <a
href="/group/ukha_xpl/post?postID=g6GWIB2VUUtu_B4PWGFP58A-xqdEYXvtfOHqFP_DAYApzNXI-v1bg444Ad3TpopdRFuCfzarZRdy4XYbqJPSDq0">ukha_xpl@xxxxxxx</a>
> To Subscribe: <a
href="/group/ukha_xpl/post?postID=579jKRrdkom0UQip-HCREsHmoZb4QZ6cvdOiC0Cy2FcVS98qBJaIl3fqCY74SnEpsarzF0IxhwiFDF9jv_S_G4ChrxTtM8wIs5v1Zg">ukha_xpl-subscribe@xxxxxxx</a>
> To Unsubscribe: <a
href="/group/ukha_xpl/post?postID=Sxcjfl42G5SCua3esDXetiuXeyn2a5Or3Es6ZCAO6qf7FiHsjrOhVrYX8ER73QkZyIJk7BLwvNvVwTa4-AT6eEd0lImpcx69ewcE">ukha_xpl-unsubscribe@xxxxxxx</a>
>
> Your use of Yahoo! Groups is subject to <a href="http://docs.yahoo.com/info/terms/";>http://docs.yahoo.com/info/terms/</a>
>
>
>
>






xPL Main Index | xPL Thread Index | xPL Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.