Mr. Muskrat mentioned the part about changing your $path = "C:\Program Files..." to use forward slahes instead of backslahes, and that's the best advice. If you really want to use your windows-formatted paths, use single quotes instead, so that your backslahes aren't taken to mean a special character. But, forward slahes look much better, and don't worry: perl is smart enough to always (I can't think of any exceptions, though there may be one or two), change the forward-slashes to backslashes in system calls.

I create a perl script (over Windows XP platform) ... #!/usr/bin/perl
Okay, I know that windows uses file associations over actually executing the shebang line (in most cases), but you should probably be using something like "#!c:/perl/bin/perl -w" as your first line (or wherever you have perl installed). Also note the use of the '-w' switch. It will make your life easier (though 'use strict' is even more life-saving, so you should probably add that one as well).

if ($ENV{'REQUEST_METHOD'} eq 'GET') { $buffer = $ENV{'QUERY_STRING'}; } else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } # Break em up into a format the script can read @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/e +g; $FORM{$name} = $value; }
{sigh}. I don't know who ever wrote this snippet, as I've seen it many many times. Put simply, it's ugly. I can rewrite that chunk of code with 2 lines:
use CGI ':standard'; my %FORM = CGI->Vars;
'perldoc CGI' for more info on this. Then there's the thing with 'path\textNX.txt', another monk has already clued you in on this one.

Summary/Revision:

  1. '/' not '\'
  2. -w or 'use warnings;'
  3. 'use strict;'
  4. 'perldoc CGI;'


In reply to Re: Perl dont write my data base by Coruscate
in thread Perl dont write my data base by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.