) { next if /^#/;#if($_=~/^#/的简写 ch" />

perl实现的两个文件对比并对数据进行筛选的脚本代码



#!/usr/bin/perl
my %scyjm;
open (CONTACT,"f:\perl\f.txt")||die("can not open the file!");
while (<CONTACT>)
{
next if /^#/;#if($_=~/^#/的简写
chomp;
my @information =split;# my @information=split/s+/,$_;的简写
next if(($information[1]=~/./) && ($information[2]=~/./));
$scyjm{$information[13]}->{$information[0]}=$information[3];
}
close CONTACT;
open (SC,"f:\perl\a.csv")||die("can not open the file!");
while(<SC>)
{
chomp;
my @sc=split;
if ( $scyjm{$sc[1]}{$sc[2]})
{
print "$sc[0] $sc[1] $sc[2] $sc[3] $sc[4] $sc[6] $yjm[6]n";
}
}

perl qw以空格为分隔符问题的解决方法
perl中创建数组时,可以使用到qw。但有一个问题,如果要创建有20个人名组成的数组,并且每个人的名字是这种形式的"Joinsmith""HarryPotter"也就是每一个名

perl中单行注释和多行注释使用介绍
Perl中的程序注释:单行注释和多行注释(一)单行注释:以#开头的行都被perl认为是注释。但是有一个例外,perl程序的第一行是#开头的,他指定了perl

perl use vars pragma使用技巧
perl中的vars是perl中的一个pragma(预编译指示符),专门用来预定义全局变量,这些预定义后的全局变量在qw()列表中,在整个引用perl文件中皆可使用,即