Inverse of 'chop @array'

Discussion in 'Perl' started by gusmeister, Mar 6, 2004.

  1. gusmeister

    gusmeister Guest

    'chop @array' removes the last character for each element in an array. If I
    want to do the inverse and append a character to each element, how would I
    do that (without using a 'foreach' loop)?
     
    gusmeister, Mar 6, 2004
    #1
    1. Advertising

  2. "gusmeister" <> wrote in message
    news:ho92c.10521$...
    > 'chop @array' removes the last character for each element in an array. If

    I
    > want to do the inverse and append a character to each element, how would I
    > do that (without using a 'foreach' loop)?


    You could use map instead, but that would just hide the loop inside of it's
    own logic.

    jue
     
    Jürgen Exner, Mar 6, 2004
    #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. Guest
    Replies:
    7
    Views:
    701
    Walter Wang [MSFT]
    Jun 28, 2006
  2. Aaron Walker

    best way to chop off leading char in string?

    Aaron Walker, Nov 22, 2003, in forum: C Programming
    Replies:
    3
    Views:
    456
    Sheldon Simms
    Nov 22, 2003
  3. Johnathan Smith

    chop and chop!

    Johnathan Smith, Jan 8, 2008, in forum: Ruby
    Replies:
    2
    Views:
    150
    darren kirby
    Jan 8, 2008
  4. yusufm

    print chop; VS chop; print;

    yusufm, Mar 9, 2006, in forum: Perl Misc
    Replies:
    2
    Views:
    128
    Tad McClellan
    Mar 9, 2006
  5. martin
    Replies:
    3
    Views:
    201
    Joe Smith
    Apr 15, 2006
Loading...

Share This Page