Help for this page

Select Code to Download


  1. or download this
    $ perl -e '@words = ("one\n","two\n","three\n","four\n","five\n","six\
    +n",); chomp @words; print join";", @words;'
    one;two;three;four;five;six
    
  2. or download this
    $ perl -e '@words = ("one\n","two\n","three\n","four\n","five\n","six\
    +n",); @words = map {split /\n/, $_ } @words; print join";", @words;'
    one;two;three;four;five;six
    
  3. or download this
    $ perl -e '@words = ("one\n","two\n","three\n","four\n","five\n","six\
    +n",); @words = map {s/\n//; $_} @words; print join";", @words;'
    one;two;three;four;five;six
    
  4. or download this
    $ perl -e '@words = ("one\n","two\n","three\n","four\n","five\n","six\
    +n",); $_ = (split /\n/)[0] for @words; print join";", @words;'
    one;two;three;four;five;six
    
  5. or download this
    $ perl -E '@words = ("one\n","two\n","three\n","four\n","five\n","six\
    +n",); local $" = ";"; $_ = (split /\n/)[0] for @words; say "@words";'
    one;two;three;four;five;six