perl.beginners
  Home FAQ Contact Sign in
perl.beginners only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
perl.beginners Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  perl module?         


Author: Levente Kovacs
Date: May 1, 2008 23:54

Ok, I've reached the level, when I want to do perl modules. I've seen
tutorials with the `h2xs' approach, but the problem is that I don't know what
it EXACTLY does.

I'd like to write a code shared among several simple scripts, as a NON-OO
module, used in single program packege. I'd be happy with some #include style
in C, but I don't know how to do that really.

Thanks for your help.

--
Levente Kovacs gmail.com>
no comments
  File and perl         


Author: Richard Lee
Date: May 1, 2008 17:45

Hi guys,

I have been running below to gather into a txt file before running perl
program to analyze the data but I want to transform into 100%% perl.
so, right now my little line says

ls -ltr | tail -100 | cut -d' ' -f13 | while read n ; do zcat -d $n |
grep -i 'server|client' | /usr/bin/program1 | egrep -i
"bunch|of|other|things" ; done > /tmp/results

I am looking to replace this w/ perl which I think I can rather do
easily on latter parts but this below I am sure

ls -ltr | tail -100 | cut -d' ' -f13

bascially I am looking for last 100 files.. is there an easy way to do
this in perl?(with and w/out modules ?)
I am going to search on this as well...

Let me know please.

thank you.
3 Comments
  Comparing files with regular expressions         


Author: Rubinsta
Date: May 1, 2008 13:09

Hello,

I'm a Perl uber-novice and I'm trying to compare two files in order to
exclude items listed on one file from the complete list on the other
file. What I have so far prints out a third file listing everything
that matches the exclude file from the complete file (which I'm hoping
will be a duplicate of the exclude file) just so I can make sure that
the comparison script is working. The files are lists of numbers
separated by newlines. The exclude file has 333 numbers and the
complete file has 9000 numbers.

Here's what I have so far:

#!/usr/bin/perl
use strict;
use warnings;

open(ALL, "all.txt") or die $!;
open(EX, "exclude.txt") or die $!;
open(OUT,'>exTest.txt') or die $!;

my @ex_lines = ;
my @all_lines = ;
Show full article (1.14Kb)
10 Comments
  Link parsing (was: Getting error...)         


Author: Gunnar Hjalmarsson
Date: May 1, 2008 11:03

hotkitty wrote:
> I ultimately want to go to cnn.com/ politics, follow all links under
> the "Election Coverage" headline and, w/in those links, save all the
> links under the "Don't Miss" sections that appear in those stories.
> However, after many hours and trial & error I've yet to complete the
> task. I know mechanize can do this somehow but I've yet to figure out
> how to put it all together.

It's not so much about putting it together; it's more like writing Perl
code step by step...
> Here's the script I have so far, which gets me to only step one:

http://www.mail-archive.com/beginners%%40perl.org/msg93769.html

Actually, I'm not sure that the code you have even gets you to step one.

As a parsing exercise, I wrote the code below. I chose to make use of
LWP::Simple and HTML::TokeParser. Please study the docs for the latter:
http://search.cpan.org/perldoc?HTML::TokeParser

#!/usr/bin/perl
use strict;
use warnings;
Show full article (2.38Kb)
no comments
  html trees Can't call method "as_text" on unblessed reference         


Author: Pat Rice
Date: May 1, 2008 08:59

Hi all
getting the following error with html trees,
I think its due to not using a global variable.

but when I try an "our" variable for the tree object I still hit the
same issue, i htnk my problem is getting the orignal object.

Any ideas ????

Can't call method "as_text" on unblessed reference at ./lastTouched3.pl line 77.

Code:
Show full article (3.60Kb)
1 Comment
  question on foreach loop         


Author: itshardtogetone
Date: May 1, 2008 07:15

Hi Members,
Can someone explain why the foreach loop did not iterate 10 times.

Thanks

#################
use strict;
use warnings;

my @data = (1..10);

foreach (@data){
splice @data,0,1;
print "printing \@data = @data\n";
}

##### results ###########
printing @data = 2 3 4 5 6 7 8 9 10
printing @data = 3 4 5 6 7 8 9 10
printing @data = 4 5 6 7 8 9 10
printing @data = 5 6 7 8 9 10
printing @data = 6 7 8 9 10
5 Comments