in reply to Concatnate long statement

Do you mean something like this?

my ( $eqpid, # This $chamber, # looks $lotid, # like $wafer_flow, # a $recipe, # good $wafer_slot, # place $step_value, # for $alarmtype, # some $sensor, # Comments! $signal_level, $alarm_upper_limit, # (C) 1980 Stick-Ups Corporation $alarm_lower_limit, $code, $date_submited, $time_submited, $filenames, $usercode, $sock, ) = @_;
You should be able to put a newline anywhere you could use a space.

Replies are listed 'Best First'.
Re^2: Concatnate long statement
by phimtau123 (Novice) on Jul 03, 2007 at 21:31 UTC
    so we dont need any special operator? like in vb we use the & for long sql statement. Thank

      You are confusing two concepts.

      To concatenate strings is to combine two strings into one. The string concatenation operator is & in VB and . in Perl.

      VB: var1 = "abc" & var2 Perl (Concatenation): $var1 = 'abc' . $var2 Perl (Interpolation): $var1 = "abc$var2"; Perl (Concatenation using join): $var1 = join('', 'abc', $var2);

      In VB, all statements must be on the same line. The _ operator allows you to break a statement into multiple lines. This has nothing to do with string concatenation. Perl doesn't require a continuation operator. Instead, one must tell Perl where the statement ends using ;.

      VB: var = func(var1, var2, var3) Perl: $var = func($var1, $var2, $var3); VB: var = func( _ var1, _ var2, _ var3 _ ) Perl: $var = func( $var1, $var2, $var3 );

      Together:

      VB: stmt = "SELECT *" & _ " FROM table" & _ " ORDER BY field" Perl: $stmt = "SELECT *" . " FROM table" . " ORDER BY field" Perl (Since SQL servers treats newlines as whitespace): $stmt = " SELECT * FROM table ORDER BY field ";
      Welcome to PerlMonks - I think you will find your life more enjoyable here than with VB :)

      Certainly free form code is much nicer. For instance you can use the string concatenation or newline examples given in other answers for tidying up your code in Socket Problem.

      The following example has a statement per line.
      #!/usr/bin/perl -w use strict; use warnings; use Time::Format 'time_format'; printf "Hello world, today is %s\n", time_format('mm dd yyyy',time); exit;
      The following example has statements broken up into lines and is still valid:
      #!/usr/bin/perl -w use strict; use warnings; use Time::Format 'time_format'; printf "Hello world, today is %s\n", time_format( 'mm dd yyyy', time ); exit;
      The following example is still valid but has unnacceptable formatting for human beings:
      #!/usr/bin/perl -w use strict; use warnings; use Time::Format 'time_format'; printf "Hello world, today is %s\n", time_format( 'mm dd yyyy', time) ; exit ;
      The following example breaks:
      #!/usr/bin/perl -w use strict; use warnings; use Time::Format 'time_format' printf "Hello world, today is %s\n", time_format('mm dd yyyy',time); exit;
      Personally I use vim, set expandtab, and I break a long statement with new line and tab. If you foresee coding perl regularly, you need a copy of Perl Best Practices by Damian Conway.