It's on the right hand-side of the regex, however. Look at the output:
C:\src\perlperl -pes{([^}]+)}(?:@{[ ($a = $1) =~ y/,/|/ $a ]})
blargh{a,b,c}blargh
blargh(?:a|b|c)blargh
The OP didn't want the ?: in there
So it is!
I'm usually a fan of one-liners, but I think this is a great
I'm looking for a regex (or a couple of regexes) to do the following:
blahblah{ab,abcd}blah -- blahblah(ab|abcd)blah
blahblah{a,b,c}blah -- blahblah(a|b|c)blah
Anybody have a faster way to do this?
__CODE__
#!/usr/bin/perl
use strict;
use warnings;
sub uncommify {
my ($glob) =
I'm having trouble w/ getstore... It works fine when I use it like this
[snip]
... but when I use in the script below, all that happens is the files are
created but they are only 1kb and can not be displayed... When I use the
script above the file size is 14kb and looks great...
## This Does what I want !!
$tmp =Joe Smore1qazxswedcvfrtgbnhytujmkilptyot5000;
($tmp) = $tmp =~ m/^(\w{3})/;
print $tmp\n; ## Joe
Why does $tmp need '(...)' ??
Regular expression matches return ($1, $2, ...) in list context. The
parentheses force that.
--
To unsubscribe, e-mail:
Is there a more compatible way to check my overly-long string?
How about:
die syntax error\n if $msgs =~ /[^\d,]/;
Cheers,
Dave
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
On Thu, 2 Dec 2004 17:19:00 -0500, Dave Gray [EMAIL PROTECTED] wrote:
Is there a more compatible way to check my overly-long string?
How about:
die syntax error\n if $msgs =~ /[^\d,]/;
Oh, I missed a requirement... after the above code:
while ($msgs =~ /(\d+)/g) {
die syntax error\n
I know I can use the find.pm. But, I'd like to know why the recoursive
I did is wrong.
There are no debug print statements in your code. There are also a lot
of 'next' statements, which always make me suspicious. See comments in
chopped-up code below.
Good luck,
Dave
== Start of code
[snip]
Charles K. Clarkson [EMAIL PROTECTED] wrote:
[snip]
: : foreach my $method ( keys %InheritableClassData ) {
: : no strict 'refs';
: : *$method = sub {
: : shift;
: : $InheritableClassData{$_} = shift if @_;
: : return $InheritableClassData{$_};
: : };
:
The purpose is simple, search directory inside $depth levels for
directories.
No need to reinvent the wheel:
http://search.cpan.org/~nwclark/perl-5.8.5/lib/File/Find.pm
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
and I have PERL5LIB defined in my .bash_profile
export
PERL5LIB=/home/gwes/usr/local/lib/perl5/5.6.0:home/gwes/usr/local/lib/site_perl/5.6.0
This looks broken... try:
export
PERL5LIB=/home/gwes:/usr/local/lib/perl5/5.6.0:home/gwes/usr/local/lib/site_perl/5.6.0
Note the colon after
this is actual part of my code.. all work but it seems that something is
wrong in foreach part.. in reality script calculate $dodatne_opcije only!
$vrsta_paketa is not added in calculation..
my $vrsta_paketa = {
'20MB' = 205,
'50MB' = 270,
'100MB' = 350,
Trying to make a subject line change for a number of scripts, but having no
luck. The original code will have something like:
$MySubject = sprintf %-s%-s%-s [descriptive Subject] for %-s\n,
$GlblInfo{subjectprefix},
Mi goal is that each thread could process an element of an array that
has 10 elements, so thread0 process array[0], thread1 process array[1]
and so on until thread9 process array[9]
Those 10 lines come from a file that Perl reads in chunks of ten lines
until EOF
First of all, your code
$VAR1 = { 'key1' = ['A',1],['B',2],['C',2]};
That isn't going to do what you think it is... What you're asking for
there is to use the ['B', 2] array reference as a hash key...
$VAR1 = {
'ARRAY(0x804ca54)' = ['C',2],
'key1' = ['A',1]
};
In order to get close to what I think you're trying
On Fri, 1 Oct 2004 10:51:50 -0400, Dave Gray [EMAIL PROTECTED] wrote:
$VAR1 = { 'key1' = ['A',1],['B',2],['C',2]};
That isn't going to do what you think it is... What you're asking for
there is to use the ['B', 2] array reference as a hash key...
$VAR1 = {
'ARRAY(0x804ca54)' = ['C',2
For example, the string
aa 444 -
should yield
, , , , , .
That's actually kind of tricky. How about:
$aa = aa 444 -;
@aa = $aa =~ /(?!\d)\d{4}(?!\d)/g;
print $_\n for @aa;
That gets and
TIMTOWTDI:
@list = grep length==4, /\d+/g
Shouldn't that be:
@list = grep length==4, $foo =~ /\d+/g;
Cool solution, I wouldn't have thought to do it that way. I'm getting
varying Benchmarking results, though. I think it might have something
to do with grep speedups from 5.6.1 to 5.8.0...
I have thre HoAs with the same key but different value.
How can I efficiently join the HoA:
my %HoA = (key1 = ['A',1]);
my %HoA2 = (key1 = ['B',2]);
my %HoA3 = (key1 = ['C',2]);
into:
%HoA = (key1 = ['A',1],['B',2],['C',2]);
I'm not sure what you want to do here... do you want to
open(FH_IN_FILE, file.txt);
# This statement is executed by some other function
close(FH_IN_FILE);
print FH_IN_FILE SOME DATA;
here before writing to file, i want to check the
status of FH_IN_FILE..(whether file is opened or
closed )
You could do something like the following:
-
101 - 119 of 119 matches
Mail list logo