in reply to Re^2: Concatnate long statement
in thread Concatnate long statement
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.#!/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;
|
|---|