Are you specifying your script in double quotes? If you are then Perl will try and interpolate the string and automatically expand out what it thinks are the Perl variables @intpos etc. Try using strict and warnings. escape any text that looks like a Perl variable that you don't want to be interpolated. the same is true for 'here document' syntax.
E.g.
my $script = <<EOF;
declare \@intpos int
declare \@intuser int
declare \@dtlastpost varchar(30)
set \@intuser = (select userid from $dbname.dbo.users where name = '$u
+ser')
set \@intpos = (select top 1 permissionid from $dbname.dbo.security wh
+ere userid = \@intuser order by permissionid desc)
set \@dtlastpost = (SELECT top 1 PostDate FROM $dbname.dbo.Messages wh
+ere userid = @intuser order by postdate desc )
EOF
In the example above I have assumed that you want to interpolate $dbname and $user.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.