[33066] in Perl-Users-Digest
Perl-Users Digest, Issue: 4342 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 4 03:09:22 2015
Date: Sun, 4 Jan 2015 00:09:03 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 4 Jan 2015 Volume: 11 Number: 4342
Today's topics:
Re: fields separation <cairukai@huawei.com>
help,perl script <salmon@yeah.net>
Re: help,perl script (hymie!)
Re: help,perl script <cairukai@huawei.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 3 Jan 2015 22:46:02 -0800 (PST)
From: sammyjeep <cairukai@huawei.com>
Subject: Re: fields separation
Message-Id: <618a527c-aea9-4cc0-bb36-5e25c7cc0b1c@googlegroups.com>
=E5=9C=A8 2014=E5=B9=B412=E6=9C=8831=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=89UTC=
+8=E4=B8=8B=E5=8D=8811=E6=97=B645=E5=88=8659=E7=A7=92=EF=BC=8CRainer Weikus=
at=E5=86=99=E9=81=93=EF=BC=9A
> =E8=94=A1=E6=B1=9D=E5=87=AF <cairukai@huawei.com> writes:
> >> > $buff=3D~s/<(\s*\n*\s*){1,}\*(\s*\n*\s*){1,}>/<*>/g;
> >>=20
> >> This obviously won't work with separators other than <*>. Further, in =
a regex
> >>=20
> >> \s*\n*\s*
> >>=20
> >> only the first \s* will ever match anything because \s matches \n,
> >>=20
> >> [rw@doppelsaurus]~#perl -e '$a =3D " \n "; $a =3D~ /(\s*)(\n*)(\s*)/;
> >> printf("|%s|, |%s|, |%s|\n", $1, $2, $3);'
> >> |
> >> |, ||, ||
> > Hi Rainer, i do not think it's the important thing, matching the \n
> > with \n or with \s. i just need match the whole pattern ant kill them.
>=20
> Assuming you want to match all whitespace and all newlines,
>=20
> \s*\n*\s*
>=20
> is really the same as
>=20
> \s*
>=20
> because \n is a whitespace-character: The first \s* will gobble up all
> of them because it is a greedy match and the \n*\s* just make the
> complete regex a little more complicated without affecting what it
> matches.
Yes, u are right, if we need the $1 to do something,it will not work. but i=
n this script is all right.
------------------------------
Date: Sun, 4 Jan 2015 13:59:53 +0800
From: "salmon" <salmon@yeah.net>
Subject: help,perl script
Message-Id: <m8aksh$2aut$1@adenine.netfront.net>
#!/usr/local/bin/perl -w
use strict;
use encoding "utf8", STDOUT =>"utf8";
while(<>)
{
chomp;
next if not ((defined $_));
my @arr = split /\t/, $_;
if (@arr +0 == 1)
{
print $_,"\n";
next;
}
if( $arr[0] =~ s/(^[^0-9a-z\p{Han}]+)|([^0-9a-z\p{Han}]+$)//ig)
{
print STDERR $_,"\n";
}
print $arr[0],"\t",$arr[1],"\n";
}
Use of uninitialized value in substitution (s///) at
scripts/rm_no_word\_char.pl line 15, <> line 30
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
------------------------------
Date: 04 Jan 2015 06:37:09 GMT
From: hymie@lactose.homelinux.net (hymie!)
Subject: Re: help,perl script
Message-Id: <54a8df95$0$8181$862e30e2@ngroups.net>
In our last episode, the evil Dr. Lacto had captured our hero,
"salmon" <salmon@yeah.net>, who said:
>Use of uninitialized value in substitution (s///) at
>scripts/rm_no_word\_char.pl line 15, <> line 30
Looking at your script, finding line 15, and not having any indication
as to what sort of data you are using, my best conclusion is that
you have an uninitialied variable and you are trying to use it
in a substitution.
--hymie! http://lactose.homelinux.net/~hymie hymie@lactose.homelinux.net
------------------------------
Date: Sat, 3 Jan 2015 22:41:21 -0800 (PST)
From: sammyjeep <cairukai@huawei.com>
Subject: Re: help,perl script
Message-Id: <2e26b447-970d-4387-9a2e-ea9e5b28a6f9@googlegroups.com>
=E5=9C=A8 2015=E5=B9=B41=E6=9C=884=E6=97=A5=E6=98=9F=E6=9C=9F=E6=97=A5UTC+8=
=E4=B8=8B=E5=8D=881=E6=97=B659=E5=88=8650=E7=A7=92=EF=BC=8Csalmon=E5=86=99=
=E9=81=93=EF=BC=9A
> #!/usr/local/bin/perl -w
> use strict;
> use encoding "utf8", STDOUT =3D>"utf8";
>=20
> while(<>)
> {
> chomp;
> next if not ((defined $_));
> my @arr =3D split /\t/, $_;
> if (@arr +0 =3D=3D 1)
> {
> print $_,"\n";
> next;
> }
> if( $arr[0] =3D~ s/(^[^0-9a-z\p{Han}]+)|([^0-9a-z\p{Han}]+$)//ig)
> {
>=20
> print STDERR $_,"\n";
> }
> print $arr[0],"\t",$arr[1],"\n";
> }
>=20
> Use of uninitialized value in substitution (s///) at=20
> scripts/rm_no_word\_char.pl line 15, <> line 30=20
>=20
>=20
> --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
try:
next if not ((defined $_)); --> next if ( $_ =3D~ /^$/ );
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 4342
***************************************