HI. First time poster... :)
I am trying to write a script that spawns a number of children processes.
The number of children processes is determined at run time based on a
configuration file. I am having trouble finding a way to create these
children processes. They have to be independant of the
Hi all. Just checking if my emails are labeled as spam. If they are I'll
have to check with my local admins and see what's going on. I'd prefer not
to be labeled a spammer while I contribute to this list. :)
Assign each line to the $_ variable and try this to get the number of
instances of < and >
The match operator works on $_ by default. If you match on < or > globally
and assign it to an array like so:
@rights = m/\/g;
You are left with arrays that contain all the matches. Now all you need to
do
Great! That works. But I was looking to get a little trickier with it.
If you want to make sure they are alternating like <><><> etc... I would do
this:
$_ = $line;
@syms = m/[<>]/g;
$string = join("", @syms);
if ($strings !~ m/^<(><)*>$/)
{
## Scream here!
}
The re
Correction: "$strings" in the if statement should be "$string"
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 27, 2004 4:04 PM
To: [EMAIL PROTECTED]
Subject: RE: Recursively counting a matching pattern on a single line.
Great! That works.
Wouldnt m/[<>]/g literally match <> and not ?
Why wouldnt it be m/[<.+>]/g ?
Thanks
Birl
---
Someone correct me if I'm wrong but putting characters inside brackets []
defines a character class. Or a group of characters you want to match on,
not necessarily in that order.
For instan
Hi, if i'm understanding you correctly, I think what you want to do should
be coded like this:
$value = 2422;
$reg = '\d';
if ($value =~ m/$reg/) {
print "Correct Value;
} else {
print "Check the Value";
}
-Original Message-
From: Prabahar Mosas [mailto:[EM
This is the way I would do it, however my code has been subject to criticism
more that once in the past :)
open (FILE, ";
close (FILE);
$new_data = "This is my new line that I am going to put at the top\n";
unshift (@file, $new_data);
open (FILE, ">myfile.dat") or die;
print FILE @file;
close (FIL
Hi. I'm working with an array that i'm pushing values on to, but I don't
want there to be any duplicates. Is there a perl function of an easy way to
check if an array already contains a value before I push that value on to
it?
Thanks,
Brian
Though about using a hash but I don't have a need for a Key/Value
combination. I just need a list without duplicates. I suppose I can define
the hash keys if they don't already exists and export the keys into an array
with the keys function. Is that what you are hinting towards?
Thanks,
Brian
---
Hi all,
Is there a module available to compare two images to detect differences
between the two, i.e. motion? Searched CPAN to no avail.
Thanks in advance!
-Brian
Sounds like a job for File::Tail
http://search.cpan.org/~mgrabnar/File-Tail-0.99.1/Tail.pm
I'm using it to monitor my auth.log file on my freebsd machine. Works like a
charm!
-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 07, 2004 9:24 AM
To: [EMAI
I don't think there is a way to make fetchrow_array() reverse the sequence
in which it delivers data. You can always store the data in a variable if
you need to use it later. Otherwise, if you are receiving rows of data from
the database in an order that makes it hard to work with you may want to t
I just realized I was way off base from your original question. :) You want
to start over again from the beginning with fetchrow_array(). I think it's
just a matter of running the execute statement again to reset it...
-Original Message-
From: Nicolay Vasiliev [mailto:[EMAIL PROTECTED]
Sen
Hi all. I would like to write a simple monitoring tool that basically
performs an action on a list of servers (ping, port check, etc) at a
specified time interval. So let's say I want to ping each server every 5
minutes. I don't want to code a loop where I ping all the servers and then
sleep for 5
That's a good idea. However I want it to run constantly, like a service. So
in some respects it would have to be a loop. Maybe embedded loops. I don't
really know :)
-Original Message-
From: Andrew Gaffney [mailto:[EMAIL PROTECTED]
Sent: Friday, December 17, 2004 3:29 PM
To: [EMAIL PROTECT
I recently installed Net::Pcap from the cpan shell and the test failed as
well. I did a force install and the install completed and it appears to be
working fine. Not sure if will be any repercussions in the future though.
-Original Message-
From: Welsh, Ed [mailto:[EMAIL PROTECTED]
Sent:
Should be as simple as:
use CGI;
$co = new CGI;
## Here I grab the info from the form field named "date"
## and assign it to the variable $data
my $data = $co->param('date');
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 29, 2004 2:14 PM
Hi all. How can I check, within a script, to see if it is being run as root
or not? I would like it to exit with an error message if it is not running
as root. I'm looking for something that works across *nix platforms so that
my script is portable. Is there a perl function that does this or perhap
If you figure it out, let me know. I had problems getting it to read the
database. I eventually quit.
-Original Message-
From: Jay [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 20, 2005 12:17 PM
To: Perl Beginners List
Subject: Geo::PostalCode
I have the following code, which dies "n
Oh come now. Maybe he's writing an auto-responder. ;) Besides, these days,
if he is spamming he can look forward to lots of fines and possible prison
time.
-Original Message-
From: Edward Wijaya [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 20, 2005 6:10 PM
To: Andrew Black; beginners@
HI. There's really two parts you need to have for a snmp get request. The
first part is the object identifier (OID). This is the long string of
numbers. The second part is the instance number. That is the zero at the end
you're asking about.
.iso.org.dod.internet.mgmt.mib-2.interfaces.ifNumber.0
Someone tell the admin that the command is 'apachectl start'
-Original Message-
From: Adamiec, Larry [mailto:[EMAIL PROTECTED]
Sent: Monday, February 28, 2005 10:01 AM
To: beginners@perl.org
Subject: RE: www.perldoc.com
I can ping www.perdoc.com successfully but I can't bring up a web pa
Hi!
I just upgraded perl on one of my UNIX machines to 5.8.0 (was 5.6.1). Of
course there is no great surprise that the new perl is telling me it can't
find any of my modules I install under the old version. So my question is,
can I add an extra path to perl @INC array to point to the location of
Hi. I am having a heck of a time installing Tk::JPEG on hpux 11.0. I know
this isn't directly perl related but I'm hoping someone has seen this before
and could lead me in the right direction.
I have downloaded the Tk-JPEG-2.014 source from cpan. I have it unpacked. I
ran "perl Makefile.PL". When
Is anyone familiar with Ruby? If so, how do you think it stacks up against
perl? I'm looking to learn another unix scripting lang and it looks like
Ruby may be a good fit.
Some excerpts from their web site:
"Ruby's syntax and design philosophy are heavily influenced by Perl. It has
a lot of syn
Hi!
"1 Could some suggest me what all I can do in Perl?"
The list would be smaller if you'd asked "what CAN'T you do with perl?".
Perl is a very powerful programming language. Speaking from personal
experience, it's helped me elevate myself above my peers and is directly
responsible for the high
The square symbol likely represents a carriage return. Windows and Unix do
not like each other's carriage returns and sometimes when you cross
information from one platform to another you get this funny square. You can
get rid if it by:
s/\015//;
or substitute it with a newline character
s/\015/
Hi all. I think I have some sort of permissions problem here i'm hoping to
get help for.
I'm running apache on HP-UX. I have a perl script that accesses a database
(local) and displays the results in a HTML table format. Pretty simple. I've
done lots of database scripting before so i figured this
Bob you are brilliant. Apache didn't have the environment but my user did. I
set the environmental variables in the script like you suggested and it
works great!
Thanks,
Brian
-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 19, 2005 1:45 PM
To: '[EMAIL
If you are using a unix system, the fork function may help you.
-Original Message-
From: Tielman Koekemoer (TNE) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 24, 2005 6:14 AM
To: Perl Beginners
Subject: To Thread or not?
Hi all,
I need to execute a shell command in a loop but the shell
Looks like you're pushing a list on to another list. In effect, appending
one to the other. @data would be the first list. The second list would be
'$x, $y'. Variables in a comma delimited fashion is the same as a list or an
array.
I usually deal with multidimensional arrays this way:
$i = 0;
whi
That's much better than my method. Didn't know you could push blocks of data
like that.
Cool :)
-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED]
Sent: Friday, June 03, 2005 3:01 PM
To: [EMAIL PROTECTED]; beginners@perl.org
Subject: RE:
I, being too lazy to look up a perl function, would use hostname command in
backticks like so:
$HostID = `hostname`;
Not sure if that will catch a newline character so I would also follow it
with this:
$HostID =~ s/\n//;
-Original Message-
From: Bret Goodfellow [mailto:[EMAIL PROTECTED]
>
> "When in Rome, do as the Romans do." It's true all over. The polite
> thing to do when participating in *any* group -- not just
> this one, not
> just internet stuff, but any human interaction -- is to adapt your
> manner of presenting yourself to be in harmony with the group.
>
> If you not
> > I, being too lazy to look up a perl function, would use
> hostname command in
> > backticks like so:
> >
> > $HostID = `hostname`;
> >
>
> Right which is why the above is "too lazy". Anyone reading this please
> don't settle for the above, it is error prone, insecure, and
> insufficient. T
> Ryan Frantz wrote:
> > For the purposes of this list, I shall always post intelligently as
> > has been stated ... For continuity, I
> > would suggest everyone does the same.
>
> Excellent suggestion.
>
> For those who would like to post replies in the preferred
> "conversational"
> style or "
Larsen, Errin M HMMA/IT wrote:
> << VERY fascinating discussions about the pros and cons of top-posting
> SNIPPED>>
>
> While I'm sure the arguments for and against the top-posting practices
> of Internet email lists are wonderful, perhaps we can change the
> subject of these emails. I keep hopin
Hi all. I am attempting to install DBD::Oracle from the perl CPAN shell. The
installation script seems to assume that oracle is installed locally. It
asks me to set ORACLE_HOME to the path the oracle is installed and to try
again. Well I don't have oracle installed locally. I want to install
DBD::O
> [EMAIL PROTECTED] wrote:
> > Hi all. I am attempting to install DBD::Oracle from the perl CPAN
> > shell. The installation script seems to assume that oracle is
> > installed locally. It asks me to set ORACLE_HOME to the path the
> > oracle is installed and to try again. Well I don't have oracle
40 matches
Mail list logo