in reply to ... for (@_) x= 2;
x= , the repetition assignment operator, only works on scalars.
So you can do:
You don't say what you want as output, but maybe you are looking for:my $str = 'ab'; $str x= 2; print $str; # 'abab'
Output:#!/usr/bin/perl use warnings; use strict; $\ = $/; @_ = ( 'a' .. 'b' ) x 2; print for @_;
edit: show example of repetition assignment on a scalara b a b
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: ... for (@_) x= 2;
by rsFalse (Chaplain) on Dec 28, 2015 at 21:27 UTC | |
by jeffa (Bishop) on Dec 28, 2015 at 22:00 UTC |