我有脚本:
# N1089767N_7_SWOPT_03-Jul-2011_78919186.xml
# N1089767N_7_SWOPT_25-Jun-2011_72745892.xml
# N1089772L_9_SWOPT_03-Jul-2011_78979055.xml
# N1089772L_9_SWOPT_20-Jul-2011_69380887.xml
# N1089772L_9_SWOPT_29-Jun-2011_74754662.xml
open( CONSULTS, "confile" );
@scons = <CONSULTS>;
close CONSULTS;
my %is_trade_id_unique;
foreach ( reverse sort consort @scons ) {
chomp;
#print $_. "\n";
if ( $_ =~ m/(\w+_\d+_\w+)_(\d+)-([A-Za-z]{3})-2011_(\d+)[.]xml/i ) {
my ( $trade_id, $date, $month, $row_num ) = ( $1, $2, $3, $4 );
if ( !$is_trade_id_unique{$trade_id} ) {
print $_. "\n";
$is_trade_id_unique{$trade_id} = 1;
}
#print $_."\n";
}
}
#N1089767N_7_SWOPT_03-Jul-2011_78919186.xml
sub consort {
$aa = $a;
$bb = …Run Code Online (Sandbox Code Playgroud) 请查看代码:我想检查功能的输入参数,在PBP中提供的Domian Conway使用croak,是否正确?我更改代码以传递http://perlcritic.com/但可能会添加$ rs =说"$ r - > {foo} <= $ check_value"; 过量
#!/usr/bin/perl
##############################################################################
# $URL: http://mishin.narod.ru $
# $Date: 2011-11-01 16:32:04 +0400 (Nov, 01 Nov 2011) $
# $Author: mishnik $
# $Revision: 1.02 $
# $Source: test check variables $
# $Description: check input parameters of function
# $ Domian Conway in PBP offer to use croak, is it correct? $
# 01-11-2011:
# put question to
# http://stackoverflow.com/questions/7963866/is-it-correct-way-to-check-function-input-values
##############################################################################
use strict;
use warnings;
use 5.010; …Run Code Online (Sandbox Code Playgroud) $ perl -e 'use warnings;my ($a,$b);$c=$a.$b;print $c'
Use of uninitialized value in concatenation (.) or string at -e line 1.
Use of uninitialized value in concatenation (.) or string at -e line 1.
Run Code Online (Sandbox Code Playgroud)
我看到
我决定了
use 5.8.4;
use strict;
use warnings;
use Test::More tests => 2;
my ( $start, $end, $sysid, $ver, $tradetype );
( $start, $end ) = ( 1, 10 );
my $test = make_string( $start, $end, $sysid, $ver, $tradetype );
is( $test, "1,10,,,\n", "make index string" ); …Run Code Online (Sandbox Code Playgroud)