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

  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. 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. Guest
    Replies:
    7
    Views:
    904
    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:
    549
    Sheldon Simms
    Nov 22, 2003
  3. Jeremy L. Moles

    chop() and empty() functions

    Jeremy L. Moles, May 26, 2006, in forum: Python
    Replies:
    6
    Views:
    3,911
    John Machin
    May 27, 2006
  4. Dan

    ruby chop! error

    Dan, Aug 23, 2003, in forum: Ruby
    Replies:
    0
    Views:
    166
  5. BearItAll

    chop problems

    BearItAll, Feb 3, 2005, in forum: Ruby
    Replies:
    7
    Views:
    236
    Robert Klemme
    Feb 3, 2005
  6. Johnathan Smith

    chop and chop!

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

    print chop; VS chop; print;

    yusufm, Mar 9, 2006, in forum: Perl Misc
    Replies:
    2
    Views:
    226
    Tad McClellan
    Mar 9, 2006
  8. martin
    Replies:
    3
    Views:
    302
    Joe Smith
    Apr 15, 2006
Loading...