Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

declare multiple strings with blank space in one line 1

Status
Not open for further replies.

Mayur09

Programmer
May 13, 2016
12
US
Hi,

I need to Declare 5 strings with Blank space,

my($a) = " ";
my($b) = " ";
my($c) = " ";
my($d) = " ";
my($e) = " ";

I am trying to do it in sinle line as below, but getting error,

my($a, $b, $c, $d, $e) = (" ");

How should I do this, just to make my code look better?
What is advisable way?
 
Hi

As far as I know, the only ways are
Perl:
[gray]# either provide value for each variable[/gray]
[b]my[/b] ($a, $b, $c, $d, $e) = ([green][i]" "[/i][/green], [green][i]"[/i][/green] ", [green][i]" "[/i][/green], [green][i]" "[/i][/green], [green][i]" "[/i][/green]);

[gray]# essentially the same, abit shorter to write[/gray]
[b]my[/b] ($a, $b, $c, $d, $e) = ([green][i]" "[/i][/green]) x 5;

[gray]# or declare and initialize separately[/gray]
[b]my[/b] ($a, $b, $c, $d, $e);
$a = $b = $c = $d = $e = [green][i]" "[/i][/green];

Feherke.
feherke.ga
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top