substitution in perl

Discussion in 'Perl Misc' started by raj.somla@gmail.com, Feb 1, 2007.

  1. Guest

    Hi,

    I have a string in curly brackets {121,121,121,asa,afr,ssf}. I want
    to remove the { and chage it to nothing.

    How do I do it?
     
    , Feb 1, 2007
    #1
    1. Advertising

  2. Mirco Wahab Guest

    wrote:
    > Hi,
    >
    > I have a string in curly brackets {121,121,121,asa,afr,ssf}. I want
    > to remove the { and chage it to nothing.
    >
    > How do I do it?


    Please post some Perl code where you tried that already.

    You mean, you have a string like:

    my $stuff = '{121,121,121,asa,afr,ssf}';

    and you need to keep only the content between {...}?

    You should apply a simple Regex

    $stuff =~ s/[{}]//g;

    or just a transliteraton,

    $stuff =~ y/{}//d;

    Regards

    M.
     
    Mirco Wahab, Feb 1, 2007
    #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. Tyson Marchuk
    Replies:
    7
    Views:
    139
    Brian McCauley
    Feb 24, 2004
  2. ari
    Replies:
    3
    Views:
    95
  3. kris

    Perl Substitution

    kris, Apr 28, 2006, in forum: Perl Misc
    Replies:
    1
    Views:
    109
  4. kp

    Command substitution in perl

    kp, Oct 7, 2006, in forum: Perl Misc
    Replies:
    5
    Views:
    817
  5. Replies:
    3
    Views:
    131
    Dr.Ruud
    Nov 22, 2006
Loading...

Share This Page