Re: split question

From: Gunnar Hjalmarsson (noreply_at_gunnar.cc)
Date: 08/24/04


Date: Tue, 24 Aug 2004 15:58:43 +0200

Tore Aursand wrote:
>
> Untested:
>
> #!/usr/bin/perl
> #
> use strict;
> use warnings;
> use Data::Dumper;
>
> my $string = 'abc def ghi jkl';
> my @parts = split( /\s+/, $string, 2 );
>
> print Dumper( \@parts );

Why on earth do you use Data::Dumper to print a two elements array?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


Relevant Pages

  • Re: Using grep to check contents of file
    ... commenting on. ... FlashMX wrote: ... > I had to disable the warnings because I get an error: ... Gunnar Hjalmarsson ...
    (perl.beginners)
  • Re: warnings on old Perl
    ... >> warnings dynamically, not lexically. ... I *think* it's possible to just put that after the package ... In a CPAN module I wrote, there is only one subroutine that is called ... Gunnar Hjalmarsson ...
    (perl.beginners)
  • Re: Retrievtring strings from a file.
    ... use strict; ... my $outfile1 = 'out1.txt'; ... strictures and warnings and to do simple debugging. ... Gunnar Hjalmarsson ...
    (comp.lang.perl.misc)
  • Re: How can I name my scalar with a for loop?
    ... use strict; ... use warnings; ... my @stn =; ... Gunnar Hjalmarsson ...
    (comp.lang.perl.misc)
  • Re: portable no warnings "uninitialized"
    ... >> generate uninitialized warnings, or turn off warnings in the ... For an ordinary module you can do e.g.: ... Gunnar Hjalmarsson ...
    (comp.lang.perl.misc)