am a newbie...

Discussion in 'Perl Misc' started by Vinod, Sep 5, 2003.

  1. Vinod

    Vinod Guest

    hi!!

    I am a beginner with Perl. am rtying to use the repetition feature as
    in -

    print 'a'x5;

    would print 'aaaaa'

    I am trying to use it with regular expressions.

    I am trying to replace an occurence of 'there' with 'aaaaa' but I dont
    want to put it there explicitly.

    I am trying something like....

    s/there/'a'x5/;

    which doesnt work.

    Can someone give me some sort of an escape sequence...?

    Thank you

    Vinod
     
    Vinod, Sep 5, 2003
    #1
    1. Advertisements

  2. Vinod

    Sam Holden Guest

    On 4 Sep 2003 21:38:35 -0700, Vinod <> wrote:
    > hi!!
    >
    > I am trying something like....
    >
    > s/there/'a'x5/;
    >
    > which doesnt work.
    >
    > Can someone give me some sort of an escape sequence...?


    s/there/'a'x5/e;

    or:

    $replace = 'a'x5;
    s/there/$replace/;

    The replacement is a quoted string, not an expression.

    See perldoc perlop for details on what /e does.

    --
    Sam Holden
     
    Sam Holden, Sep 5, 2003
    #2
    1. Advertisements

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. Id0x
    Replies:
    4
    Views:
    1,265
    Erik Max Francis
    Jul 21, 2003
  2. JohnE

    newbie with newbie questions

    JohnE, Aug 17, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    587
    Gregory A. Beamer
    Aug 17, 2009
  3. Jerry C.
    Replies:
    8
    Views:
    347
    Uri Guttman
    Nov 23, 2003
  4. Kruno Saho
    Replies:
    0
    Views:
    219
    Kruno Saho
    Apr 7, 2013
  5. Dave Angel
    Replies:
    0
    Views:
    178
    Dave Angel
    Apr 7, 2013
Loading...

Share This Page