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
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
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
= 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
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
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
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
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
-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
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
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
, 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
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
) { ... }
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
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
, 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
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
, 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
];
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
, 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
-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
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
; '
--
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
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
();
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
= (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
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
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
, 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
;
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
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
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
' . $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
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
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
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
) 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
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
, @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
(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
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
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
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
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
[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
}
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
+.*/){
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
{ $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
,
) == 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
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
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
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
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
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
;
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
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
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
, 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
. 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
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
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
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
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
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
, $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
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
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
.
--
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
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
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
. 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
= 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
= 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
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
=$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
. 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
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
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
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
.
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
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
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
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
.
--
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
= 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
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
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
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
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
[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
$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
...
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
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
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
}
}
--
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
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
, = 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
'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
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
, $_;
}
--
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
601 - 700 of 1486 matches
Mail list logo