Today I wrote some perl5 code for the umpteenth time. Basically:
for( my $i=0; $i $#ARGV; $i++ )
{
next unless $ARGV[$i] eq -f;
$i++;
$ARGV[$i] = absolute_filename $ARGV[$i];
}
chdir foo;
exec bar, @ARGV;
I'm trying to work out if there's a clever perl6 way to write
Dave Whipp wrote:
Today I wrote some perl5 code for the umpteenth time. Basically:
for( my $i=0; $i $#ARGV; $i++ )
{
next unless $ARGV[$i] eq -f;
$i++;
$ARGV[$i] = absolute_filename $ARGV[$i];
}
chdir foo;
exec bar, @ARGV;
I'm trying to work out if there's a
On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote:
I'm trying to work out if there's a clever perl6 way to write this using
pattern matching:
for @*ARGV - -f, $filename {
$filename .= absolute_filename;
}
There is, but it's a different kind of pattern matching:
if @*ARGV ~~ / ,
In perl 5:
my @a = (1,2,3);
delete $a[1];
print exists $a[1];
This is false, whereas $a[0] and $a[2] do exist. This is creepy. Not
only is it creepy, it raises a whole bunch of questions with
nontrivial answers:
* does [EMAIL PROTECTED] include nonexistent elements?
* does
Luke Palmer wrote:
On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote:
Would this actually work, or would it stop at the first elem that
doesn't match (-f, ::Item)?
If by stop you mean die, yes it would stop.
not what I wanted :-(
Is there some way to associate alternate codeblocks for
On Fri, Jan 13, 2006 at 10:33:23PM +, Luke Palmer wrote:
In perl 5:
my @a = (1,2,3);
delete $a[1];
print exists $a[1];
This is false, whereas $a[0] and $a[2] do exist. This is creepy. Not
only is it creepy, it raises a whole bunch of questions with
nontrivial answers:
On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote:
What happens if I simply abandon the attempt at anonymous MMD and use a
named multi-sub, instead:
{
my multi sub process_arg(-f, Str $f is rw) {
$f .= absolute_filename
}
my multi sub process_arg(--quux, Str arg1, Str arg2) {
On Fri, Jan 13, 2006 at 11:42:13PM +, Luke Palmer wrote:
: On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote:
: What happens if I simply abandon the attempt at anonymous MMD and use a
: named multi-sub, instead:
:
: {
: my multi sub process_arg(-f, Str $f is rw) {
:$f .=
On 13/01/06 20:36, Dave Whipp wrote:
Is there some way to associate alternate codeblocks for different
patterns (i.e. local anonymous MMD)?
Is it possible to have an anonymous multi sub?
This would seem to require new syntax for combining two anonymous
definitions.
Of course we want
On Fri, Jan 13, 2006 at 10:33:23PM +, Luke Palmer wrote:
: In perl 5:
:
: my @a = (1,2,3);
: delete $a[1];
: print exists $a[1];
:
: This is false, whereas $a[0] and $a[2] do exist. This is creepy. Not
: only is it creepy, it raises a whole bunch of questions with
: nontrivial
10 matches
Mail list logo