M
Martin Kissner
Michele Dondi wrote :
I forgot to "set :nonu" before copying.
Sorry for the inconvenience.
Good question. What do you think of that solution?
#!/usr/bin/perl
use warnings;
use strict;
local $/;
my $content = <DATA>;
$content =~ s/\n\D//g;
$content =~ s/(^\d+|\n\d)/$1-/g;
print $content;
__DATA__
1sampletextsampletextsamplet22tsampletextsampletextsampletext
2sampletextsampletextsampletextsam56etextsampletextsampletext
3sampletextsampletextsampletextsampletextsampletextsampletext
[...]
Is the foo() form cheaper because it doesn't pass @_ ?
Thank you, for your feedback.
There's hardly any need IMHO to include line numbers. To be fair,
personally I find them to be disturbing...
I forgot to "set :nonu" before copying.
Sorry for the inconvenience.
Do you _really_ need this $lastline algorithmic madness?
Good question. What do you think of that solution?
#!/usr/bin/perl
use warnings;
use strict;
local $/;
my $content = <DATA>;
$content =~ s/\n\D//g;
$content =~ s/(^\d+|\n\d)/$1-/g;
print $content;
__DATA__
1sampletextsampletextsamplet22tsampletextsampletextsampletext
2sampletextsampletextsampletextsam56etextsampletextsampletext
3sampletextsampletextsampletextsampletextsampletextsampletext
[...]
Just to make sure I understood:There's no need to use the &-form of sub call in Perl5: most likely it
won't do what you mean. See 'perldoc perlsub'.
Is the foo() form cheaper because it doesn't pass @_ ?
Thank you, for your feedback.