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. Jenny

    dotnet newbie question

    Jenny, Jul 13, 2003, in forum: ASP .Net
    Replies:
    9
    Views:
    1,394
    K_Lee
    Nov 6, 2003
  2. suzy

    newbie: tables/layout

    suzy, Jul 27, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,128
  3. raagz
    Replies:
    2
    Views:
    3,182
    Ed Crowley
    Jul 31, 2003
  4. Alan S.

    Re: A newbie .NET question

    Alan S., Sep 4, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    985
    Jerry Dennany
    Sep 26, 2003
  5. Id0x
    Replies:
    4
    Views:
    1,451
    Erik Max Francis
    Jul 21, 2003
  6. JohnE

    newbie with newbie questions

    JohnE, Aug 17, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    781
    Gregory A. Beamer
    Aug 17, 2009
  7. Jerry C.
    Replies:
    8
    Views:
    586
    Uri Guttman
    Nov 23, 2003
  8. Dennis Lee Bieber

    Re: Newbie to python. Very newbie question

    Dennis Lee Bieber, Apr 7, 2013, in forum: Python
    Replies:
    1
    Views:
    158
    Miki Tebeka
    Apr 8, 2013
Loading...