Perl is a free-form language when comes to syntax layout. You don't need special operator to break your statement into as many lines as you like, or as your eyes can handle. But I'm not going to write a subroutine with that many arguments. I either use hash (for using named parameters instead of positional parameters), or break up the subroutine.

The same applies with string. Just type in the long string, and break it at your will.

my $str = "This string is not that long but I break it anyway becauase Perl allows me to do so and I just want to do it this way. But remember, there will be newlines inserted between lines";
Or, if you like, use the concatenation operator:
my $str = "This string is not that long" . " but I break it anyway becauase" . " Perl allows me to do so and I just want to" . " do it this way. But remember, there will not" . " be newlines inserted between lines" . " unless I say it explicitly," . " like\n" . " this";
Many Perl programmers, however, prefer to use here-doc syntax:
my $str = <<EOF; This string is not that long but I break it anyway becauase Perl allows me to do so and I just want to do it this way. But remember, there will be newlines inserted between lines. I can also put $some ($variables) here. EOF

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!


In reply to Re: Concatnate long statement by naikonta
in thread Concatnate long statement by phimtau123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.