split/Perl question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: James Durham
Date:  
Subject: split/Perl question
What you may think about doing is using the "escape subroutin" in perl module
CGI.pm. that way every special char including the ":" is converted. Then you
unescape everything before using it on your website etc...

#---start of example script---
#!/usr/local/bin/perl -w

use CGI;

$string = "http://www.slashdot.org";
$blea = CGI::escape($string);

print "Original String: $string\n";
print "Escaped String: $blea\n";

$aelb = CGI::unescape($string);

print "Unescaped the Escaped String: $aelb\n";
#---end of example script---
--Output--
Original String: http://www.slashdot.org
Escaped String: http%3A%2F%2Fwww.slashdot.org
Unescaped the Escaped String: http://www.slashdot.org
--end of output--

On Monday 11 November 2002 01:16 pm, Mike Starke wrote:
> I have a colon delimited text file that I need parse thru and grab each
> value. My problem is that some values actually contain a colon. Using the
> code below is not quite enough to extract the values:
>
> while (<>) {
> @array = split(":", "$_");
> }
>
> I seem to recall this same problem before but can not remember
> what I did to get around this. Can anyone point me in the right
> direction?
>
> v/r
> -Mike
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss