[NBLUG/talk] Another stupid Perl question....

Mark Street mark at oswizards.com
Tue Jun 7 14:12:02 PDT 2005


Let's say I get a response back from a webserver and I assign that response 
into a variable $res

$res = $ua->request($req1)->as_string;

Now I have everything I want inside of that var $res.  I tried to use a 
substring function to try to grok out some values but I am missing 
something......  Tell me please...

$ss = get_ss( "SERVERSESSION=\"", $res );
########
sub get_ss( $$ ) {
	# $_[0] = string to search for, e.g., SERVERSESSION
	# $_[1] = string to search, e.g., $res

	return substr( $_[1], index( $_[1], $_[0] ) + length($_[0]), 18 );
} 
########
-- 
Mark Street, RHCE
http://www.oswizards.com
--
Key fingerprint = 3949 39E4 6317 7C3C 023E  2B1F 6FB3 06E7 D109 56C0
GPG key http://www.oswizards.com/pubkey.asc



More information about the talk mailing list