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
In reply to Re: ... for (@_) x= 2;
by 1nickt
in thread ... for (@_) x= 2;
by rsFalse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |