variable in HERE document

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike

    variable in HERE document

    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
  • Jürgen Exner

    #2
    Re: variable in HERE document

    mike wrote:[color=blue]
    > 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??[/color]

    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.
    [color=blue]
    > I need to have the 'EOF' instead of "EOF"[/color]

    Why?

    jue


    Comment

    Working...