Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6173383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:33:46+00:00 2026-05-23T23:33:46+00:00

The following section of code is working as expected… create table todel (id int

  • 0

The following section of code is working as expected…

create table todel (id int not null auto_increment, name varchar(100), primary key (id));
insert into todel values (NULL, '24');
select @myid:=last_insert_id();
insert into todel values (NULL, @myid);

mysql> select * from todel;
+----+------+
| id | name |
+----+------+
|  1 | 24   |
|  2 | 1    |
+----+------+

But the same code does not work when I try to wrap it in perl code.

vi myperl.pl

#!D:\Perl\bin\perl

open (output_file, ">myperl.txt");
@Program_ID = '24';
print output_file
"create table todel (id int not null auto_increment, name varchar(100), primary key (id));
insert into todel values (NULL, '@Program_ID');
select @myid:=last_insert_id();
insert into todel values (NULL, '@myid');";

close(output_file);

It generates the code as shown below. The mysql variable name @myid is missing.

# cat myperl.txt
create table todel (id int not null auto_increment, name varchar(100), primary key (id));
insert into todel values (NULL, '24');
select :=last_insert_id();
insert into todel values (NULL, '');

How do I let perl know that I do not want to replace the mysql variable? I want to replace the @Program_ID variable though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:33:47+00:00Added an answer on May 23, 2026 at 11:33 pm

    Try

    insert into todel values (NULL, '\@Program_ID');
    select \@myid:=last_insert_id();
    insert into todel values (NULL, '\@myid');";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code's else part isnt working, i.e. click is not getting enabled. if
I have the following section of code in an app that I am writing:
I'm wondering why this code section prints out the following: print request.user.has_perm('bug_tracking.is_developer'): + str(request.user.has_perm('bug_tracking.is_developer'))
I have following Code Block Which I tried to optimize in the Optimized section
I'm following the sample code in CFNetwork Programming Guide , specifically the section on
The C# 3.0 spec has the following code example in section 10.6.1.3 Output parameters:
On F# WikiBook under Encapsulating Mutable State section, there is a following code snippet.
I am facing this strange problem with the following section of code <% if
I'm using the following section of code to display some icons on our Magento
I'm working on an iOS app and I'm using the following code for one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.