Re: wildcat pattern matching

2003-07-13 Thread Jeff 'japhy' Pinyan
capturing parentheses: ($artist) = $tmp =~ m{artist(.*?)/artist}; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm

Re: null fields from split

2003-07-13 Thread Jeff 'japhy' Pinyan
there's an empty string in between the ! and @, as well as between the @ and #. I think you want to change your regex to /$TOKEN_DELIMS+/o instead. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org

Re: Search and Replace

2003-07-13 Thread Jeff 'japhy' Pinyan
can do the translation of | to h using the tr/// operator also: tr/|/h/ for @filecontents; That transliterates ALL |'s to h's, for each string in @filecontents. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org

Re: Question on For loop usage in Perl

2003-07-13 Thread Jeff 'japhy' Pinyan
= 31, $n = $initial; $j =0 and $n = $final; --$j, ++$n) { # ... } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course

Re: null fields from split

2003-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, John W. Krahn said: Jeff 'Japhy' Pinyan wrote: On Jul 13, David Storrs said: Given this code: my $TOKEN_DELIMS = qr/[^\w\-'\$]/; my $text = # string containing the contents of an mbox file my @tokens = split /$TOKEN_DELIMS/o, $text; I end up with a large number

Re: Search and Replace

2003-07-13 Thread Jeff 'japhy' Pinyan
of substitutions made. That's the main difference I see. tr/// is only for character-to-character translations. It doesn't work for strings: s/foo/bar/g and tr/foo/bar/ do not work the same way. tr/// is ONLY for characters. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com

Re: null fields from split

2003-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, John W. Krahn said: Sometimes I am never really sure about /o and the qr// operator accepts it as well which is more confusing. :-) Heh, yeah. That's a very RARE condition indeed. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734

Re: match count

2003-07-11 Thread Jeff 'japhy' Pinyan
of the substitution is remove all B's that have A before them. If A isn't constant-width, then you can't use a look-behind. It's silly to replace AB with A, since that requires work. It's easier to say match A, then pretend you just started matching, and replace B with nothing. -- Jeff japhy

Re: Regular expression problem.

2003-07-05 Thread Jeff 'japhy' Pinyan
-and-white world? -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like my work, let

Re: match count

2003-07-05 Thread Jeff 'japhy' Pinyan
you've matched X, pretend you started matching HERE. It comes in handy in substitutions that look like s/(A)B/$1/; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand

Re: Regex question

2003-07-01 Thread Jeff 'japhy' Pinyan
means does not match } or else use a negative look-ahead: if ($filename =~ /\.(?!gz|html)[^.]*$/) { # (?!...) means is not followed by } I think the first one is easier to understand at this stage. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia

Re: Exiting a subroutine on error

2003-06-30 Thread Jeff 'japhy' Pinyan
, bar or do { # this # that return; }; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking

Re: Pattern matching

2003-06-29 Thread Jeff 'japhy' Pinyan
wanted THREE digits. I would suggest the following regex: /\d\s+\d\s+\d/ Ta da. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate

Re: Regex problem

2003-06-25 Thread Jeff 'japhy' Pinyan
) { ... } There's no need to use the regex engine if you're absolutely NOT using patterns. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course

Re: multi-line matches / named.conf parsing

2003-06-24 Thread Jeff 'japhy' Pinyan
it looks like a duck doesn't mean it's a duck. In this case, the .. operator is the flip-flop operator. In scalar context, .. is flip-flop, while in list context, .. is range. perldoc perlop -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: context, printing, and concatenation

2003-06-23 Thread Jeff 'japhy' Pinyan
, but if so I don't understand why. Can someone break it down what the concatenation operator is doing here? The concatenation operator joins two SCALARS together. That means that its two arguments will be evaluated in scalar context, so it's like saying print( (scalar(@array) . \n) ); -- Jeff japhy

Re: There has to be a way to do this

2003-06-23 Thread Jeff 'japhy' Pinyan
the regexes on its input? -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like

RE: Array Question (Learning Perl/Win32 Chapter Test Question)

2003-06-20 Thread Jeff 'japhy' Pinyan
, humans are thinking +1 from what computers are thinking. To correct this, you subtract 1 from what the human enters, and the computer does the right thing. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http

Re: Why did @{$$a}[$i]; fix my problem?

2003-06-19 Thread Jeff 'japhy' Pinyan
]; This sounds like $curr_true is not a reference to an array, but rather a reference TO a reference to an array. Find out where you added that layer of indirection. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http

Re: Stupid(?) Question on System set

2003-06-19 Thread Jeff 'japhy' Pinyan
, it DOESN'T have a built-in called 'set' in it. Why not just use the %ENV hash? -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course

Re: regexp example

2003-06-18 Thread Jeff 'japhy' Pinyan
-z0-9], and after the \d there is a ], which can't be matched by \d. s/\\([a-zA-Z0-9]+) (\[\d+\])/$1$2/g; I might even go so far as to say s/\\([a-zA-Z0-9]+) (?=\[\d+\])/$1/g; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: logical and pattern matching

2003-02-20 Thread Jeff 'japhy' Pinyan
On Feb 20, R. Joseph Newton said: if (/a/i and /e/i and /i/i and /o/i and /u/i) {print;} If you really want a one-regex solution, here's one. I don't suggest its use, though. print if /(?=.*a)(?=.*e)(?=.*i)(?=.*o)(?=.*u)/i; -- Jeff japhy Pinyan [EMAIL PROTECTED] http

Re: slicing array with range operator

2003-02-20 Thread Jeff 'japhy' Pinyan
; ' -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know

Re: Confused on hash references

2003-02-13 Thread Jeff 'japhy' Pinyan
humor etiquette in the Perl community.) -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming

Re: How to alarm under 1 second?

2003-02-10 Thread Jeff 'japhy' Pinyan
(); select (undef,undef,undef, $waittime); kill 14 = ppid; I'm sure you meant $ppid; SIG{ALRM} = sub {die;} And $SIG{ALRM}. selfalarm(0.1); And there's no reason to quote a number. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: confused with File::Glob

2003-02-08 Thread Jeff 'japhy' Pinyan
= (func() || die); whereas with 'or', your code is like (@files = func()) || die; And || enforces scalar context, so func() won't (can't) return a list, in your case. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org

Re: How does one print blocks of text ..

2003-02-06 Thread Jeff 'japhy' Pinyan
On Feb 6, Jamie Risk said: ... without encapsulating each line in double quotes? I've seen this, and don't know where. With a here-doc: print END OF BLOCK; stuff END OF BLOCK Or with a different quoting character: print qq{ this text is nice isn't it? }; -- Jeff japhy Pinyan

Re: Quoted and unquoted spilts

2003-02-06 Thread Jeff 'japhy' Pinyan
one this way: my @parts = grep defined, $str =~ m{(.*?)|(\S+)}g; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm

RE: parsing a datafile.

2003-02-04 Thread Jeff 'japhy' Pinyan
, if you set $/ to a reference to a number. while(read(F, $buf, 65)) { Can be: $/ = \65; while (F) { my ($f1, $f2, $f3) = unpack 'a10 a15 a40', $_; Also, Bob, you read into $buf, but you're upacking $_. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI

Re: parsing a datafile.

2003-02-04 Thread Jeff 'japhy' Pinyan
; should be \65, not 65. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like my

Re: Subscript question

2003-02-04 Thread Jeff 'japhy' Pinyan
On Feb 4, Zysman, Roiy said: Why does the command 'print (localtime(time))[4];' does not work Others (like Jenda) have already told you. Here is one solution: print +(localtime)[4]; You don't need to use time(), by the way -- it's the default argument to localtime(). -- Jeff japhy Pinyan

Re: including subroutines from other files ...

2003-02-04 Thread Jeff 'japhy' Pinyan
On Feb 4, Jamie Risk said: How does one do this? perldoc -f require -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course

Re: Trouble with referencing hash entry

2003-02-04 Thread Jeff 'japhy' Pinyan
' . $device{$_} . x\n; I'd check the length of $_, too. It might have an unprintable character in it. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why

Re: Subscript question

2003-02-04 Thread Jeff 'japhy' Pinyan
On Feb 4, R. Joseph Newton said: Jeff 'japhy' Pinyan wrote: On Feb 4, Zysman, Roiy said: Why does the command 'print (localtime(time))[4];' does not work Others (like Jenda) have already told you. Here is one solution: print +(localtime)[4]; You don't need to use time(), by the way

Re: system() call fails

2003-02-04 Thread Jeff 'japhy' Pinyan
will $! be useful. @MakeCmd = (nmake, -f, Nmakefile.mak); $rc = system(@MakeCmd); print rc = $rc - $!\n; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why

Re: an EXPR question

2003-01-30 Thread Jeff 'japhy' Pinyan
understand. You want to check that a string starts with '-key' and ends with '-5L'. You'll need a regular expression with these ingredients: He may not want the ^ and $ anchors, so /-key.*5L/ might suffice. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia

Re: how to use pos fn.

2003-01-29 Thread Jeff 'japhy' Pinyan
) to get the starting position of the current match. If you're using an older version of Perl, you'll have to do something like pos($str) - length($) -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http

Re: A better way, a perl way?

2003-01-23 Thread Jeff 'japhy' Pinyan
On Jan 22, david said: @data_ = map { (my $copy = $_) =~ s/^ //; $copy } @data; s/^ // for(@data_ = @data); Sigh. I usually do that. I was a little slow on the idiom-uptake. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: A better way, a perl way?

2003-01-22 Thread Jeff 'japhy' Pinyan
, @data_ and @data are exactly the same. If you DON'T want that, you'd have to do: for (@data) { (my $copy = $_) =~ s/^ //; push @data_, $copy; } Or something to that effect. Here's a one-liner: @data_ = map { (my $copy = $_) =~ s/^ //; $copy } @data; -- Jeff japhy Pinyan

Re: translation

2003-01-20 Thread Jeff 'japhy' Pinyan
(for me, I guess), your boss got the tr/// line from the all your base craze of a few years ago. The right-hand side contains all the characters needed for ALL YOUR BASE ARE BELONG TO US!. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: Nested hash creation help !

2003-01-20 Thread Jeff 'japhy' Pinyan
splitting string) splits like /\s+/, but it also ignores leading whitespace. split( , ab cd ef ) - ab, cd, ef split(/\s+/, ab cd ef ) - , , ab, cd, ef -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org

Re: Nested hash creation help !

2003-01-20 Thread Jeff 'japhy' Pinyan
On Jan 20, John W. Krahn said: Jeff 'Japhy' Pinyan wrote: split( , ab cd ef ) - ab, cd, ef split(/\s+/, ab cd ef ) - , , ab, cd, ef ^^ Where did that extra string come from? :-) Oops. Yes, there should only be one there. I

Re: trapping errors in use

2003-01-20 Thread Jeff 'japhy' Pinyan
On Jan 21, Victor Tsang said: $mod = CGI; unless (eval use $mod) { warn unable to install $mod $@\n; } } Change your eval() to eval use $mod; 1; which forces a true value to be returned if 'use' runs successfully. -- Jeff japhy Pinyan [EMAIL PROTECTED

Re: Restarting at top of file

2003-01-02 Thread Jeff 'japhy' Pinyan
at the same time. while (PEL) { chomp; s/ +//g; # remove spaces my ($value, $field) = split /,/; $dup{$field}++; $vend{$field} = $value; } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http

RE: Restarting at top of file

2003-01-02 Thread Jeff 'japhy' Pinyan
[1]}=$temp[0] unless ($dup{$temp[1]} 1); } while (PEL) { chomp; s/ +//g; my ($value, $field) = split /,/; $dup{$field}++; if ($dup{field} == 1) { $vend{$field} = $value } else { delete $vend{$field} } } That looks to me like it will work. -- Jeff japhy Pinyan

RE: Restarting at top of file

2003-01-02 Thread Jeff 'japhy' Pinyan
} This is only true the FIRST time the field is seen. And 'field' should be $field. My apologies. else { delete $vend{$field} } This happens ALL other times $field is encountered. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: Regexpr

2002-12-16 Thread Jeff 'japhy' Pinyan
+.*/){ print $1 $2\n; } The [\d\,]* matches 19,466, but then \s+ can't match because the next character is a ., so eventually, [\d\,]* matches NO characters at all (since * means zero or more). Try: if (/^POINT\s+Point Health Centers\s+([\d.,]+)/) { $val = $1; } -- Jeff japhy

Re: How to get the biggest integers from an array?

2002-12-11 Thread Jeff 'japhy' Pinyan
{ $array[$b] = $array[$a] } 0 .. $#array ] = 1 ..@array; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking

Re: Return Status

2002-12-10 Thread Jeff 'japhy' Pinyan
, ) == 0; } next unless mount(); -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work

Re: Difference between $count++ and ++$count

2002-12-06 Thread Jeff 'japhy' Pinyan
evaluated: $j = (++$i + ++$i) + ++$i; # ++$i sets $i to 3 # ++$i sets $i to 4 # ($i + $i) returns 8 # ++$i sets $i to 5 # 8 + $i returns 15 CRAZY. Or logical. Both, really. Oops. This is [EMAIL PROTECTED] Sorry. ;) -- Jeff japhy Pinyan [EMAIL PROTECTED] http

Re: references in perl...

2002-12-06 Thread Jeff 'japhy' Pinyan
and cause the sudden heat death of the Universe. Or would make a C or C++ programmer treat Perl like C (no offense). And Pointer.pm would need to do a whole lot overloading operators. And that's too much work for me right now. ;) -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com

RE: Seek tell

2002-12-06 Thread Jeff 'japhy' Pinyan
or better). if ($data =~ m[\f\d{2}/\d{2}/\d{2}]) { $p = $-[0]; last; } If you don't have Perl 5.6, you'll need to be a bit more creative: if ($data =~ m[(\f\d{2}/\d{2}/\d{2})]g) { $p = pos($data) - length $1; last; } -- Jeff japhy Pinyan [EMAIL PROTECTED] http

Re: If - Else What?

2002-11-26 Thread Jeff 'japhy' Pinyan
should be using warnings (-w). Perl would tell you: Found = in conditional, should be == at -e line 1. if you ran your code. You need to change your #! line to #!/usr/bin/perl -w -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: HTML::TokeParser/Parsing problem

2002-11-25 Thread Jeff 'japhy' Pinyan
On Nov 24, sulfericacid said: use LWP::Simple use HTML::TokeParser You're missing semi-colons after those two 'use' statement.s -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does

Re: HTML::TokeParser/Parsing problem

2002-11-25 Thread Jeff 'japhy' Pinyan
; use strict; You usually put 'use ...' statements at the top of a program -- it's easier to tell exactly what is required. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y

Re: a question about output

2002-11-24 Thread Jeff 'japhy' Pinyan
about the $| variable. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like

Re: a question about output

2002-11-24 Thread Jeff 'japhy' Pinyan
On Nov 25, Chris Ball said: how can I output first line\n and last line\n to the screen but save the result of system command ls to a file(eg result)(not appear on the screen)? On 24 Nov 2002 23:42:50, Jeff 'japhy' Pinyan [EMAIL PROTECTED] said: Unbuffer STDOUT: $| = 1

Re: Modulus operator, unexpected results

2002-11-22 Thread Jeff 'japhy' Pinyan
, though. while (...) { my $bg = $count++ % 2 ? #bde6de : #ff; # ... } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate

Re: How to find list of variables and sub routines loaded, dynamically.

2002-11-22 Thread Jeff 'japhy' Pinyan
. You don't need to release them, though. You should use properly scoped lexicals instead of globals. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss

Re: localtime

2002-11-22 Thread Jeff 'japhy' Pinyan
to perform arithmetic on the month value!?? Don't get the month NAME. Get the month NUMBER: my $mon = (localtime)[4]; my @last_six_months = @mon[($mon-5) .. $mon]; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org

Re: Starter of a script

2002-11-22 Thread Jeff 'japhy' Pinyan
environment variables in a hash; %ENV. Your process id number is $ENV{PID}. You can just use the $$ variable too. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand

Re: localtime

2002-11-22 Thread Jeff 'japhy' Pinyan
On Nov 22, John W. Krahn said: @mons = ( qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/ ) x 2; $mon = (localtime)[4] + 12; print @mons[$mon - 5 .. $mon] Why the double array? (-5 .. 0) works just as well as (6 .. 11). -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com

Re: avoid grepping a string

2002-11-22 Thread Jeff 'japhy' Pinyan
On Nov 22, Tanton Gibbs said: @temp_str = grep { $_ !~ /HOLD/ }, @temp_str; @temp_str = grep { !/HOLD/ }, @temp_str; No comma after the block. grep BLOCK LIST or grep EXPR, LIST -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: simple (???) regex help

2002-11-20 Thread Jeff 'japhy' Pinyan
at all. if (length($str) == 6) { ... } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming

Re: problems with variables

2002-11-19 Thread Jeff 'japhy' Pinyan
, $email4, etc. You want to use an array. The array @email will holds $email[0], $email[1], $email[2], etc. And you'll know how many email addresses you have be doing $count = @email; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: Big hash question.

2002-11-19 Thread Jeff 'japhy' Pinyan
to be able to say: $zone = $this_hash{$zip}; or @zips = @{ $this_hash{$zone} }; If you want to do both, you could. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand

Re: Declare $main::scalar in begin with 'use strict'

2002-11-19 Thread Jeff 'japhy' Pinyan
have the solution for you. You can use the INIT block. It is executed immediately after compile-time. my $log; INIT { $log = set_log() } ... sub set_log { ... } Try it out. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: Special Name for @ Element

2002-11-19 Thread Jeff 'japhy' Pinyan
. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know

Re: Declare $main::scalar in begin with 'use strict'

2002-11-19 Thread Jeff 'japhy' Pinyan
On Nov 19, Wiggins d'Anconia said: Jeff 'japhy' Pinyan wrote: snip If you're using Perl 5.6, I have the solution for you. You can use the INIT block. It is executed immediately after compile-time. For clarification, this is 5.6. and anything after, correct? Yes, good point. -- Jeff japhy

Re: hash

2002-11-18 Thread Jeff 'japhy' Pinyan
iterator for each hash, shared by all each, keys, and values func- tion calls in the program; it can be reset by reading all the elements from the hash, or by evaluating keys HASH or values HASH. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia

Re: The basics of SWITCH

2002-11-04 Thread Jeff 'japhy' Pinyan
. A switch statement in Perl can be written as the OP showed. SWITCH here is just a label. FOO: { if ($x == 1) { ...; last FOO; } if ($x == 2) { ...; last FOO; } ... } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: Data storage problem

2002-11-04 Thread Jeff 'japhy' Pinyan
= something(); push @saved, \%hash; } or, use the anonymous hash constructor to COPY the contents of the hash: for (...) { %hash = something(); push @saved, { %hash }; } But I prefer the first method. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI

Re: hard coded

2002-11-03 Thread Jeff 'japhy' Pinyan
= shift or die usage: $0 machine\n; my $file = $machine\\LABEL\\comepr_voblist.txt; open FILE, $file or die can't read $file: $!; while (FILE) { chomp; system cleartool, mount, $_; } close FILE; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI

Re: Redirection of printf function?

2002-10-29 Thread Jeff 'japhy' Pinyan
On Oct 29, Michael Hooten said: Is it possible to assign the output of the printf function to a scalar variable instead of writing the output to STDOUT? Use sprintf() instead of printf(). -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734

Re: GET

2002-10-28 Thread Jeff 'japhy' Pinyan
=$Val;; Or else quote the argument: open FH, GET 'http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=$Val' |; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular

Re: Easy one [getting OCT from localtime]

2002-10-27 Thread Jeff 'japhy' Pinyan
. References (such as \$x, \@y, \%z, and [4]) return a number in numerical context. $x = localtime[4]; is the same as $x = localtime(0 + [4]); -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org

Re: Current working directory and @INC

2002-10-27 Thread Jeff 'japhy' Pinyan
On Oct 27, George Szynal said: Please show a good way to append the current working directory to @INC. To append a value to any old array, you use push() @list = qw( a b c ); push @list, 'd'; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother

Re: Current working directory and @INC

2002-10-27 Thread Jeff 'japhy' Pinyan
On Oct 27, Paul Johnson said: On Sun, Oct 27, 2002 at 02:35:55PM -0500, Jeff 'japhy' Pinyan wrote: On Oct 27, George Szynal said: Please show a good way to append the current working directory to @INC. To append a value to any old array, you use push() @list = qw( a b c ); push @list

Re: Wildcards not working

2002-10-27 Thread Jeff 'japhy' Pinyan
On Oct 28, mike said: I am trying to cd into a directory referenced by a value in a list with wildcards like shell command First get the value from glob(): $value = foo*; @matches = glob $value; Then work with the values in @matches. -- Jeff japhy Pinyan [EMAIL PROTECTED] http

Re: The 'use' pragma vs. Foo::bar syntax

2002-10-26 Thread Jeff 'japhy' Pinyan
. package Other; # ... @ISA = qw( Exporter ); @EXPORT_OK = qw( ac_check blowpage writedate ); -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl

Re: 2 regexs into 1

2002-10-25 Thread Jeff 'japhy' Pinyan
On Oct 25, Beau E. Cox said: Again - how can I strip s from the beginning AND end of a scalar w/one reges, not these two? s/^//; s/$//; Do you know how much more efficient those two regexes are than any one-regex solution you could come up with? -- Jeff japhy Pinyan [EMAIL PROTECTED

Re: Easy one

2002-10-25 Thread Jeff 'japhy' Pinyan
On Oct 25, [EMAIL PROTECTED] said: How do a convert a string $string into uppercase?? perldoc -f uc $big = uc $little; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular

RE: Easy one

2002-10-25 Thread Jeff 'japhy' Pinyan
a system command! Use the built-in localtime() function: my $month = (split ' ', uc localtime)[1]; localtime(), in scalar context, returns a string like Fri Oct 25 10:30:23 2002 I'm uppercasing it, splitting it on whitespace, and getting the 2nd element (OCT). -- Jeff japhy Pinyan [EMAIL

Re: Recursively displaying the contents of a directory

2002-10-25 Thread Jeff 'japhy' Pinyan
. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course

Re: using getopt()

2002-10-25 Thread Jeff 'japhy' Pinyan
= 12, ... ); I love it. I don't use it enough Working on a Friday night, waiting for the hellish traffic to subside, Sorry, I was out at parties this evening. ;) The college life is good. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734

Re: a speedy find grep?

2002-10-24 Thread Jeff 'japhy' Pinyan
On Oct 24, Deb said: From the command-line, I'm currently running a find command piped to xargs grep: find . -f print | xargs egrep some string to look for Why not use the -r option to e?grep to do recursive searches? egrep -r pattern . -- Jeff japhy Pinyan [EMAIL PROTECTED

Re: a speedy find grep?

2002-10-24 Thread Jeff 'japhy' Pinyan
On Oct 24, Deb said: Jeff 'japhy' Pinyan [EMAIL PROTECTED] had this to say, Why not use the -r option to e?grep to do recursive searches? egrep -r pattern . H... Well, on Solaris 5.7, there is no -r option :-(. Ouch. A grep variant with no recursive-feature? Could you, by any chance

Re: How to wrap a sentence?

2002-10-19 Thread Jeff 'japhy' Pinyan
japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm

RE: Hierarchical Construction/Destruction

2002-10-18 Thread Jeff 'japhy' Pinyan
NEXT module. It lets you do $self-NEXT::initialize(%args); which is like SUPER::, but it's automagically recursive, like my code was (more or less). -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http

Re: regular expression

2002-10-18 Thread Jeff 'japhy' Pinyan
[please don't top-post -- it makes the discussion difficult to follow] On Oct 17, Mandar Rahurkar said: On Thu, 17 Oct 2002, Jeff 'japhy' Pinyan wrote: On Oct 17, Mandar Rahurkar said: Hi, I am trying to write a regular expresssion which reads as : from the list of following files

RE: dereferencing a array element reference

2002-10-18 Thread Jeff 'japhy' Pinyan
$r; print $r; # 15 -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why

Re: dereferencing a array element reference

2002-10-18 Thread Jeff 'japhy' Pinyan
... That's because the $ binds to the $_, and not to the $_[0]. You want print var 1 is ${ $_[0] } and 2 is ${ $_[1] }; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular

Re: Hierarchical Construction/Destruction

2002-10-18 Thread Jeff 'japhy' Pinyan
go to its parents' parents, though. That's why the NEXT:: module is so nifty keen. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning

Re: regular expression

2002-10-18 Thread Jeff 'japhy' Pinyan
form has no comma, the second does. Your code is the 2nd form, and you're logically negating a hash reference. You want either grep { !/^$spkr/ } @list; or grep !/^$spkr/, @list; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http

Re: Question about assigning a value to an array.

2002-10-18 Thread Jeff 'japhy' Pinyan
} } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate

Re: regular expression

2002-10-18 Thread Jeff 'japhy' Pinyan
japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking

Re: Join Problem

2002-10-18 Thread Jeff 'japhy' Pinyan
, = grep length, @columns; or more safely: print join , = grep defined length, @columns; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published

Re: Hierarchical Construction/Destruction

2002-10-18 Thread Jeff 'japhy' Pinyan
'refs'; # sorry, but it's a bit more convenient this way for (@{ ${class}::ISA }) { $self-initialize(%args); } } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look

Re: Extended regexp help to fix a potential bug with DBI::Shell

2002-10-18 Thread Jeff 'japhy' Pinyan
On Oct 17, Robert Thompson said: (?!=\\)$prefix I think you just want (?!\\), not (?!=\\). The = isn't part of the assertion. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org

Re: How can I open and read two files at once in a loop?

2002-10-18 Thread Jeff 'japhy' Pinyan
, $_; } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate

<    2   3   4   5   6   7   8   9   10   11   >