how do you interpoplate against units in a here-doc?

Discussion in 'Perl Misc' started by ~greg, Feb 6, 2006.

  1. ~greg

    ~greg Guest

    problem is something like this:

    var $WIDTH = 10;
    print OUT <<__;
    ....
    width: $WIDTHpx;
    ....
    __

    to print
    ....
    width: 10px
    ....


    What can be insert between the "$WIDTH" and the "px to make this work?

    (don't want to break up the here-doc.

    Thought of using $X = "" but that obviously doesn't work.
    If there is a special variable (like $_)
    that's == "", that might work.)
     
    ~greg, Feb 6, 2006
    #1
    1. Advertising

  2. ~greg

    DJ Stunks Guest

    ~greg wrote:
    > problem is something like this:
    >
    > var $WIDTH = 10;
    > print OUT <<__;
    > ...
    > width: $WIDTHpx;
    > ...
    > __
    >
    > to print
    > ...
    > width: 10px
    > ...
    >
    >
    > What can be insert between the "$WIDTH" and the "px to make this work?


    \ (but it throws a warning)

    -jp
     
    DJ Stunks, Feb 6, 2006
    #2
    1. Advertising

  3. ~greg

    John Bokma Guest

    "~greg" <> wrote:

    > width: $WIDTHpx;


    ....

    > What can be insert between the "$WIDTH" and the "px to make this work?


    use: ${WIDTH}px;

    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    I ploink googlegroups.com :)
     
    John Bokma, Feb 6, 2006
    #3
  4. ~greg

    DJ Stunks Guest

    John Bokma wrote:
    > "~greg" <> wrote:
    >
    > > width: $WIDTHpx;

    >
    > ...
    >
    > > What can be insert between the "$WIDTH" and the "px to make this work?

    >
    > use: ${WIDTH}px;
    >


    of course... duh.

    my bad,
    -jp
     
    DJ Stunks, Feb 6, 2006
    #4
  5. ~greg

    ~greg Guest

    right right, sorry! sorry!

    (i did try {$WIDTH} first ...
    --- and it didn't work .... duh..duh! )

    thanks.


    "DJ Stunks" <> wrote in message news:...
    >
    > John Bokma wrote:
    >> "~greg" <> wrote:
    >>
    >> > width: $WIDTHpx;

    >>
    >> ...
    >>
    >> > What can be insert between the "$WIDTH" and the "px to make this work?

    >>
    >> use: ${WIDTH}px;
    >>

    >
    > of course... duh.
    >
    > my bad,
    > -jp
    >
     
    ~greg, Feb 6, 2006
    #5
  6. ~greg

    John Bokma Guest

    "~greg" <> wrote:

    > right right, sorry! sorry!
    >
    > (i did try {$WIDTH} first ...
    > --- and it didn't work .... duh..duh! )


    greg, don't top post but reply underneath the part you're replying to.

    Thanks,

    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    I ploink googlegroups.com :)
     
    John Bokma, Feb 6, 2006
    #6
    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. John Wallace
    Replies:
    0
    Views:
    489
    John Wallace
    Jul 22, 2003
  2. Matt
    Replies:
    3
    Views:
    539
    Tor Iver Wilhelmsen
    Sep 17, 2004
  3. Praveen Chhangani

    Converting a org.jdom DOC to org.w3c DOC

    Praveen Chhangani, Aug 5, 2003, in forum: XML
    Replies:
    2
    Views:
    1,000
    Johannes Koch
    Aug 7, 2003
  4. Porthos
    Replies:
    2
    Views:
    352
    Martin Honnen
    Nov 3, 2005
  5. News123
    Replies:
    0
    Views:
    304
    News123
    Feb 6, 2010
Loading...

Share This Page