variable in HERE document

Discussion in 'Perl' started by mike, Jun 30, 2004.

  1. mike

    mike Guest

    hi

    i have a here doc assigned to a variable

    my $datetime = "30 Jun 2004" ;

    my $strings <<'EOF'
    declare @lastaccessdate = "$datetime"
    declare @today_date = "30 Jun 2004"
    EOF

    how can i interpolate the $datetime variable
    inside the here doc?? I need to have the 'EOF' instead of "EOF"

    thanks
    mike, Jun 30, 2004
    #1
    1. Advertising

  2. mike wrote:
    > hi
    >
    > i have a here doc assigned to a variable
    >
    > my $datetime = "30 Jun 2004" ;
    >
    > my $strings <<'EOF'
    > declare @lastaccessdate = "$datetime"
    > declare @today_date = "30 Jun 2004"
    > EOF
    >
    > how can i interpolate the $datetime variable
    > inside the here doc??


    You are explicitely asking perl _not_ to interpolate the variable but to
    take the text "$datetime" literally.
    If you want a variable to be interpolated then use the proper double quotes.

    > I need to have the 'EOF' instead of "EOF"


    Why?

    jue
    Jürgen Exner, Jun 30, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    703
    Dennis Lee Bieber
    Apr 11, 2006
  2. George Hester

    Try over here likely more to the point here

    George Hester, Sep 30, 2004, in forum: Javascript
    Replies:
    0
    Views:
    110
    George Hester
    Sep 30, 2004
  3. FAQ server
    Replies:
    0
    Views:
    155
    FAQ server
    Aug 10, 2006
  4. FAQ server
    Replies:
    0
    Views:
    130
    FAQ server
    Oct 7, 2006
  5. FAQ server
    Replies:
    0
    Views:
    148
    FAQ server
    Dec 4, 2006
Loading...

Share This Page