Newbie question: format output 
Author Message
 Newbie question: format output


> HI -

> Here's a softball for someone... but I need the help!

> How do I format form text so that CGI outputs it to an HTML document but
> where I can see the commas and not comma%27s ?

> The parse code I used follows which, I'm told, is pretty common...

[ most code deleted ]

>  $value =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg;

Your problem is the space in the middle of that line, between
the "] [".  Your script recognizeds "%2 7", but net "%27".

You can tell Perl that this space is there only for legibility,
not for matching, with the /x modifier:

   $value =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/egx;

Alternatively, you can leave out the space:

   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

Hope this helps,

-- HansM

Thu, 20 Feb 2003 04:10:03 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Software Programmer's Online Toolbox

2. newbie question: formatting user input for HTML output

3. Question about output formats and numbers

4. Question regarding variable output formats

5. Convert type form C to Pascal

6. The weekly FAQ item about the Pascal newsgroups' reorganization

7. CRT probs

8. Registry


10. Grey scale pallette under Windows

11. ATTN: Apollo/Vista Software web site down (being re-built)

12. Newbie Perl format question


Powered by phpBB® Forum Software