that is, w/o the '?' after the char spec but different than:
$text =~ s/((?:\S{80,})?[,;.])(\S)/$1 $2/g;
[MAS] I'm not sure why this works for you. It didn't for me when I created
some test data and tried it. Mine worked the same as the greedy match and
only inserted one space at the last [,;.].
Hi
We received some code to split up long non-white space strings - it has:
$text =~ s/(\S{80,}?[,;.])(\S)/$1 $2/g;
That is, if you've got 80+ non-whitespaces in a row (supposedly 'zero or
one'), followed by any(,.;)and then another non-whitespace, insert a blank.
This works but behaves the same
> Error message:
Use of uninitialized value in subroutine entry at
/m1/shared/perl/5.8.5-09/lib/5.8.5/sun4-solaris/Socket.pm line 373.
Bad arg length for Socket::pack_sockaddr_in, length is 0, should be 4 at
/m1/shared/perl/5.8.5-09/lib/5.8.5/sun4-solaris/Socket.pm line 373.
> I'm installing using
If you want order, you need an array - hashes are unordered. As you're
using count as keys, you can sort them (make its a numeric sort) but just
push your hash on to an array (an "AoH") instead:
while( my $f = readdir( DIR )) {
next if( $f eq '.' or $f eq '..' );
my($t
Deane wondered:
> Still not sure how the double-post got doubled, though, nor why you
ended up with five copies. Ah, 'tis a mystery... One I've seen happen
before, to myself and others. Send one answer, everybody out there gets
two.
>From (one of the many of ;-) your post:
To: [EMAIL PROT
> Report any error while converting the string.
I thought this was an important part of the problem ... ;->
a
Andy Bach
Systems Mangler
Internet: [EMAIL PROTECTED]
VOICE: (608) 261-5738 FAX 264-5932
"CM/ECF is a complex unfinished suit. Pull on a loose cuff thread and
your pants fall down."
while (<>) {
if ( not /\|/ ) {
warn "bad data line: $_";
next;
} # if no pipe
chomp;
my ($whoknows, $oneletter, $date_str ) = split(/\|/);
if ( not defined( $date_str ) ) {
warn "bad data line - no date string: $_";
next;
} # if no date
if ( len
> $command =~ s/\-x// should work
Note - the dash only needs to be escaped when its in a position to
possibly denote a char range, so:
s/-z//;
and:
s/a-z//;
s/0-9//;
are okay, and:
s/[a-z]//;
does what you expect (removes first lower case letter). Sneaks up on you,
though, in:
s/[&[EMAIL PROT
'.' is an RE metachar, so, at the least, you want to escape it:
split(/\./
If you're fairly confident about the format:
my ($a, $b, $c, $d, $e, $f) = split(/[^\d]/, $projectnumber);
that is, split on non-digits or specify the actual chars:
my ($a, $b, $c, $d, $e, $f) = split(/[-\/.]/, $projectnum
open (LECTOR1, "$datainfo/students_creados") || die "ERROR: NO Encuentro
el archivo 'students_creados'\n";
while () { #PRIMER WHILE
chomp;
@linea = split;
$login = $linea[7];
if ($name[0] =~ /$login/i){
$count1 += 1;
if ($count1 >
>From the Dumpvalue pm
# Check for reused addresses
if (ref $v) {
my $val = $v;
{ no strict 'refs';
$val = &{'overload::StrVal'}($v)
if defined %overload:: and defined &{'overload::StrVal'};
}
($address) = $val =~ /(0x[0-9a-f]+)\)$/ ;
if (!$self->{dum
On unix, in vi:
:1,$s///
will delete all the dos '\r' line endings. That's Ctrl-V to get special
char mode, which ends up looking (here, anyway) like Ctrl-M. For
perl:
http://www.perlmonks.org/index.pl?node_id=36555
or (same page, only faster ;-):
http://perlmonks.thepen.com/36555.html
I beli
You may also want to look at the module TIme::HiRes if you want to see
smaller than a second intervals. If you want to test your program's
execution times as in benchmarking, see the module Benchmark
a
Andy Bach, Sys. Mangler
Internet: [EMAIL PROTECTED]
VOICE: (608) 261-5738 FAX 264-5030
"
I'm running on unix (5.6) and that is a cutnpaste of my working script.
'course it wrapped along the way ... what system are you useing? Did you
'unwrap' the array assignment line? What failure did you get?
I didn't ask the question, the spaces should be okay, but it also works
w/o them:
my @
This works:
#!/usr/bin/perl -w
use strict;
my @CmdList = ('/tmp/hello.pl', ' -p ', '"this is my parm"', ' -m ',
'"this is my message"', ' -o ', '"this is my option"', " data1 data2 data3
data4 data5");
print "cmd: ", @CmdList, "\n";
exec "@CmdList";
#!/usr/bin/perl -w
use vars qw($opt_m $opt_o $
15 matches
Mail list logo