> Hi, > Adding Perl to the list of languages... and came across a question of > loading vars with very long strings... > > Actually I am modifiying a prior employee's code and want to make it > more readable. > > currently the code is such: > my $longlist = "Clause1|Clause2|Clause3|Clause4|...|ClauseN"; > > I would like to know why I can't make this more readable? Is it because > newline characters would be added to the mix? I would like to do > something like this: > > my $longlist = "Clause1| > Clause2| > Clause3| > Clause4| > ...| > ClauseN"; >
Depends on how the variable is then used. Because it is a quoted string newlines and lots of whitespace is added to the string, which will likely then throw off other formatting or parsing of the string. If you want you could put the clauses into an array quoting them separately then just 'join' to build the $longlist. This would be one way to improve readability through formatting. Using constants, loading the values from a config file automatically, etc. might be other ways. To me as long as there isn't anything else going on further down the line it isn't unreadable. For those in legacy editors/terminals they would disagree I suppose... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>