Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    
    $string = '   abc   def   ';
    ...
    print '2: ' . ( join '|', @array1 ) . "\n";
    
    print '3: ' . ( join '|', @array2 ) . "\n";
    
  2. or download this
    BEGIN { $^W = 1; }
    $string = '   abc   def   ';
    @array1 = split(?\s+?, $string, 0);
    @array2 = split(?\s+?, $string, 0);
    print '2: ' . join('|', @array1) . "\n";
    print '3: ' . join('|', @array2) . "\n";
    
  3. or download this
    2: abc|def
    3: |abc|def