Re: [Perl-unix-users] '?' on a {} char length specification

2008-12-10 Thread Andy_Bach
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 [,;.].

[Perl-unix-users] '?' on a {} char length specification

2008-12-10 Thread Andy_Bach
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

Re: [Perl-unix-users] dns error or socket setting make pm fail?

2008-05-12 Thread Andy_Bach
> 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

Re: [Perl-unix-users] perl Hash help

2007-01-23 Thread Andy_Bach
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

Re: [Perl-unix-users] How to parse a date string and convert it intomm/dd/yyyy format

2007-01-05 Thread Andy_Bach
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

Re: [Perl-unix-users] How to parse a date string and convert it intomm/dd/yyyy format

2007-01-05 Thread Andy_Bach
> 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."

Re: [Perl-unix-users] How to parse a date string and convert it into mm/dd/yyyy format

2007-01-05 Thread Andy_Bach
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

Re: [Perl-unix-users] Re: question of regular expression

2004-10-28 Thread Andy_Bach
> $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

Re: [Perl-unix-users] Problem that I am having with split command

2004-04-14 Thread Andy_Bach
'.' 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

Re: [Perl-unix-users] How to compare variable in the same file

2003-03-11 Thread Andy_Bach
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 >

Re: [Perl-unix-users] REUSED ADDRESS in Data::dumper

2003-02-26 Thread Andy_Bach
>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

Re: [Perl-unix-users] Perl script on Apache Unix server

2003-02-18 Thread Andy_Bach
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

Re: [Perl-unix-users] Running time

2003-02-14 Thread Andy_Bach
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 "

Re: [Perl-unix-users] Re: exec list and Getopt:Long don't get along

2003-02-12 Thread Andy_Bach
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 @

[Perl-unix-users] Re: exec list and Getopt:Long don't get along

2003-02-12 Thread Andy_Bach
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 $