Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Deparse isn't as reliable as I thought

by harleypig (Monk)
on Mar 03, 2006 at 21:47 UTC ( #534376=perlmeditation: print w/replies, xml ) Need Help??

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
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://534376]
Approved by Corion
Front-paged by Courage
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-06-23 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (125 votes). Check out past polls.

    Notices?