in reply to Re^5: Clear the contents of the text file
in thread Clear the contents of the text file
There is no need to give append an empty array
1nickt: Not true according to testing:
When you give a function/method/sub an empty array as an argument, what do you think that sub gets/receives in the parameter list? Its nothing.
$ perl -le" sub f { print scalar @_ }; f(1,2); f( @ARGV ); " 2 0 $ perl -le" sub f { print scalar @_ }; f(1,2); f( @ARGV ); " a b c 2 3
Your test is not a self contained test
You also seems to be dealing with some kind of shell
It really doesn't show what you think it shows
#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd /; use Path::Tiny qw/ path /; my $goner = path( 'goner' ); $goner->spew("1\n\2\n\3\n"); dd( $goner->slurp_raw ); $goner->append( { truncate => 1 } ); dd( $goner->slurp_raw ); $goner->remove; __END__ "1\r\n\2\r\n\3\r\n" ""
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Clear the contents of the text file
by 1nickt (Canon) on Jul 22, 2015 at 03:18 UTC | |
by Anonymous Monk on Jul 22, 2015 at 03:35 UTC | |
by 1nickt (Canon) on Jul 22, 2015 at 03:45 UTC | |
by Anonymous Monk on Jul 22, 2015 at 04:04 UTC |