you have a question on how to do something in Perl, or
you need a Perl solution to an actual real-life problem, or
you're unsure why something you've tried just isn't working...
then this section is the place to ask. Post a new question!
However, you might consider asking in the chatterbox first (if you're a
registered user). The response time tends to be quicker, and if it turns
out that the problem/solutions are too much for the cb to handle, the
kind monks will be sure to direct you here.
open(my $count_file,"<","count.txt") or croak "cant open";
open($count_file,">","count.txt") or croak "cant open";
print $count_file $count;
Ok, I need to parse webpages (that I wrote, but has been modified by others), and extract pertinent information stored within <div> </div> tags of class 'listing'. I'll list a sample entry below and then detail what I wish to parse out of it, with the format of another sample. Hopefully this will make sense and I'll gladly accept any advise as to which modules to use to make this easier.
<span style="font-weight: normal;">Parry's agave</span>
<br>$20.00 3 quart
<br><span id="native">Native</span> Sun
to part shade Zones 5-10 Family: <i>Amaryllidaceae</i>
<br>From the Southwest comes this lovely agave. Thick spiny
leaves adorn this hardy agave. Ultimate
clump size is about 36" with each leaf being maybe 5" across. The
flower stalk can reach 12 feet tall. Please plant in well drained soil
in a place
where children don't play. <span id="hummingbird">Hummingbirds</span>
Ok, what I'd like to get out of this (and there's a lot more html junk around it to ignore) is:
Latin name (ie agave parryi)
Common name (Parry's agave)
Pot price ($20.00)
Pot size (3 quart)
Pot price ($12.00)
Pot size (quart)
Exposure: Sun to part shade
Text description:From the Southwest comes this lovely agave. Thick spiny leaves adorn this hardy agave. Ultimate clump size is about 36" with each leaf being maybe 5" across. The flower stalk can reach 12 feet tall. Please plant in well drained soil in a place
where children don't play.
Special Features: Hummingbirds (there's others of those...but I can handle generalization (I think))
Ok, sorry for such a long post...but I wanted to give a good thorough example.
I'm interested in recommendations for clustering with attributes of being fast over lightweight/small. So I'd prefer loops over one-liners if the loop can be executed faster. Now I'm looking through the large list of various CPAN archives (AI, Bayes, Cluster, etc) and would like narrow down the search. I don't mind getting the source code and having to hack if doesn't quite match what I need to do rather than having an expectation of something work as is.
The input data is a mixture of integers and strings, all categorical data. I'd like to look at each data line as an array and do vector processing, think of it as a 1d image processing problem, how many pixels are different.
I'd like to create a distance measurement based only on the number of categories that are different, in this case, the distance map would be (cat2,cat3,4). There will probably be a weighting function applied to this metric as well.
Once the training is complete then for a new line make a prediction with the classify/cluster.
I'm currently running a cgi Perl application that has worked fine on IIS. We moved the application over to a Linux server and set up mod_perl on it. On the Linux server we're getting some strange results. When we click on a link for mugs (let's say for simplicity sake) we get 5 mugs. If we go to a page for shirts we get 12 t-shirts show up. If we go back to the mugs page it may show the 5 mugs but if you do a refresh (one, twice, or a few times) we'll end up getting 5 mugs displayed along with 3-6 t-shirts from the old link. What could possibly cause values like this to stick around but still get the correct items as well? I'm hoping some suggestions can be thrown out without having to post the lengthy code. Any help would be appreciated.
Write a program called calculate.pl which will operate as a primitive calculator operating on a single number (the 'accumulator') whose value may be modified by user commands. The program should meet the following requirements:
When called with arguments, interprets them as names of files containing commands.
When called without arguments, reads commands from standard input. You may find it easy or at least entertaining to run the program in this mode.
Commands are lines that match one of the following patterns:
The intended effects of those commands can be seen in the following capture of program interaction. User input is EQUALS, CLEAR, PLUS, OVER, TIMES, MINUS. The accumulator starts out undefined.
Many of the references I've found to .packlist files are for maintaining them or finding the appropriate one for a module. What I am looking for (before I write it) is a script/module that will USE the .packlist to create a tarball of the already deployed module for further deployment.
Background: I have reference machines (one per OS) where I build Perl. Initial version builds on those machines are tarballed up, pushed out to production machines with no build tools - not even "make" - and untarballed. Currently, new and updated modules are added to these reference copies and the whole of the Perl reference copy is tarballed up and pushed. I'd prefer to be more granular if only from a psychological standpoint: pushing out a new module version is less intimidating-sounding than pushing out the whole distribution. So...
Does anyone know of such a beast?
If not, how about some namespace suggestions when I write it myself?