simple scope question
when is a global not a global?
or how to get a value from inside a while() to the outside?
two tests-extracted from much large program to show my problem
test 1
my $count;
my $service;
while( ($service) = $SERVICE->fetch
it!
Tom Phoenix wrote:
On 9/10/06, John Ackley <[EMAIL PROTECTED]> wrote:
Trying to split class C IPs into network and host parts.
For educational or experimental reasons, I hope, since you're writing
your own low-level code instead of using a module.
this works but I expected the
Trying to split class C IPs into network and host parts.
this works but I expected the host part in $2:
print "<$bu>\n" if $debug;
if( $bu =~ /^((\d+\.){3})(\d+)$/ ) {
print "$1 $2 $3\n" if $debug;
}
output:
<172.19.252.130>
172.19.252. 252. 130
where did my
o need to store the image as it is created each time viewed but
I have not figured out how I might create an image and spit it out without
first creating a file. Maybe I should switch to javascript and let it draw
the image in the user's browser!
John
Tom Phoenix wrote:
On 8/24/06,
script runs as expected from command line - user root
fails when launched by Apache - user nobody
# perl -c plot.cgi
Args must match #! line at plot.cgi line 1.
where did I go astray?
script is owned by root with suid set
-rwsr-sr-x 1 root wheel 5415 Aug 24 11:42 plot.cgi
--
To unsubscri
e strict;
my $oldimage = "/usr/local/billmax/html/images/day-0020a6-5a9bfc*";
my $files = unlink glob $oldimage;
print "Files $files\n";
--------
fails
John Ackley wrote:
thanks to all who replied
down to this
# pe
thanks to all who replied
down to this
# perl -e "print unlink glob
'/usr/local/billmax/html/images/day-0020a6-5a9bfc*';"
1
but in script
my $oldimage = "/usr/local/billmax/html/images/day-0020a6-5a9bfc*";
my $files = unlink glob $oldimage;
fails
--
To unsubscribe, e-mail: [EMAIL PROTECTED
Thanks
in line comments
Tom Phoenix wrote:
On 8/19/06, John Ackley <[EMAIL PROTECTED]> wrote:
`/bin/rm -f \"$oldimage\"`;
`/bin/rm /tmp/errormessage`;
Why not simply use Perl's unlink function?
apparently unlink will not deal with wild cards in $oldimage
(neede
I have a program which should create a new image
after deleting the old. Image names have $$ embeded
to assure uniqueness (within a reasonable period of time).
The following backticks don't work as expected.
`/bin/rm -f \"$oldimage\"`;
`/bin/rm /tmp/errormessage`;
`/usr/local/bin/gnuplot $gpfil
[EMAIL PROTECTED] wrote:
Hi,
I am a beginner in perl and am having a dickens of a time trying to identify
this pattern in messages. [URL
Here is what I have:
if ($FORM{'message} =~ /\[URL/ig) {
#do something;
}
Where $FORM('message') is a messaage that includes many l
Ryan Moszynski wrote:
i have this string extracted from a text file i'm writing a program to
process:
test_freq = 1.0001;
and i have to extract the "1.0001"
i can't count on the whitspace being where it now is.
I would like to change this line of perl
$getTestFRQ =~ s/\D+//g;
so that
argument 2 of DateCalc() should be "$days days ago" NOT "$days ago"
sorry
John Ackley wrote:
Khairul Azmi wrote:
Hi all,
I have this problem. There is a script that stores log files into
folders
that follows structure of the following
/MM/DD
eg..
/var/log/proj
Khairul Azmi wrote:
Hi all,
I have this problem. There is a script that stores log files into folders
that follows structure of the following
/MM/DD
eg..
/var/log/projects/2006/06/20/8231.tgz
/var/log/project1/2006/06/21/1432.tgz
/var/log/projects/2006/06/22/1756.tgz
/var/log/projects/20
There is more than one way to do it!
#! /usr/bin/perl -w
use strict;
my $DELIMITER = "\t";
my $state = 0;
while(<>) {
if($state) {
next if /Detailed explanation:|Normal/;
if(/Number of containers.*= (.*)$/) {
print "$DELIMITER$1\n";
command line you see the instructions to build a display sent to the browser
on browser you see how browser reacted to those instructions
sfantar wrote:
sfantar a écrit :
Charles K. Clarkson a écrit :
sfantar wrote:
: In the apache's error log, here is what's written :
: : : [error] HTML::Te
Jenda Krynicky wrote:
From: John Ackley <[EMAIL PROTECTED]>
there is more than one way to do it
is there an easier way to do this map:
my $index = 0;
while( my @a = $SQL->fetchrow_array) {
my %a = map { $fieldnames[$index++] => $_ } @a;
print "$_ => $a
there is more than one way to do it
is there an easier way to do this map:
my $index = 0;
while( my @a = $SQL->fetchrow_array) {
my %a = map { $fieldnames[$index++] => $_ } @a;
print "$_ => $a{$_}\n" for (keys %a);
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional comma
Wijaya Edward wrote:
Hi,
I have two strings that I want to compute the number of mismatches between them. These two strings are of the "same" size. Let's call them 'source' string and 'target' string. Now, the problem is that the 'source' and 'target' string may come in ambiguous form, meaning th
Ken Perl wrote:
If I want to use regular expression to extract the charactors after
the last '/' in the url, but below regexpr doesn't work, what I do
wrong?
$url = 'http://website.com/path/file_name.img';
if (/\/.*$/)
{
print $url."is matched \n";
}
else
{
print "failed";
}
--
perl -e
Mazhar wrote:
Hi Folks,
i have written down a code in perl which is used as a file
analyser. I need to run the same on Windows 2000. Should i need to install
Active State Perl on the same.
Is there any other alternative for running the same without installation of
Active State Perl on t
Smith, Derek wrote:
I want to use truncate to delete a matched line out a named.conf file on
my DNS box.
Here is my code
use strict;
use warnings;
my $file = qq(/usr/local/admin/perl/derek_perl/test);
open (FH, "+< $file");
while ( ) {
unless (/\Acheck\-names/) {
Mattheus Henrique wrote:
Hi, I'm learning Perl but I've found some difficulties:
Why doesn't this:
[code]
#!/usr/bin/env perl
use warnings;
use strict;
while(<>){
if(/[A-Z][^A-Z]+/){
print;
}
}
[/code]
Act like this:
[code]#!/usr/bin/env perl
use warnings;
use strict;
while(<
to recurse through the values
for $key1 (keys %hash) {
for $key2 (keys %{$hash{$key1}}) {
for $integer (keys %{$hash{$key1}{$key2}} ) {
print "\$hash{$key1}{$key2}{$integer}
= $hash{$key1}{$key2}{$integer}\n";
}
}
}
--
To unsubscribe, e-mail: [EMAIL PROTE
I have a perl script that becomes a zombie.
It runs fine for days or weeks checking for new data every 60 seconds.
But after a long period of time running on Red Hat 9, Fedora Core 4,
and now Fedora Core 5 it remains in memory as an active process and
maintains its network tcp/ip connections but
perl wrote:
Is there a nice clean perl way to test to see if only one key of a hash
has data?
%some_hash = ( key1 => 1, key2 => 2 ); should fail the test
%some_hash = ( key2 => 2 ); should pass the test
%some_hash = ( key1 => 1 ); should pass the test
Thank you
print keys(%some_hash) == 1
My favorite is Date::Manip by Sullivan Beck - check www.cpan.org
which does just about anything your can think of associated with date
and time
in just about any language
use Date::Manip;
$days=&Date_DaysInMonth($m,$y);
Mike Blezien wrote:
Hello,
I am trying to come up with a function,
Thanks Shawn - I think I got it now.
The first @ in
@[EMAIL PROTECTED] = split /\t/,$rec;
flags list context for the split
else a $ would flag a scalar context
which is deprecated because of the implicit
split to @_ that could clobber subroutine arguments.
And (mis)use of $ rather than @ lead
Inherited code (from Verisign): @[EMAIL PROTECTED] = split /\t/,$rec;
which worked but really puzzled me.
I assumed that it meant[EMAIL PROTECTED] = split /\t/,$rec;
which worked also as I verified by testing both versions.
However [EMAIL PROTECTED] = split /\t/,$rec;
gives the warning quo
28 matches
Mail list logo