RE: Updating an array within a hash

2004-02-10 Thread Stephen Hardisty
> Hi Everybdy, > I am stuck in a problem for which I need your help. My > problem spins around adding an element in an array > within a hash. > I have a hash declared as $hash{"1"[EMAIL PROTECTED]; now I > want to add an element to it within a loop. How would > I do this? I would be highly gratefu

RE: 1 doubt.

2003-12-10 Thread Stephen Hardisty
> Name "main::FH" used only once: possible typo at t.pl line 6. It's because it's used only once ;o) . If you just declare something (variable, filehandle etc.) but don't use it, something's probably wrong with your code (such as a typo). If you try reading or writing using that filehandle the e

RE: traslating HTML special chars

2003-10-31 Thread Stephen Hardisty
> Hi to all, > > I'm having bad times trying to solve this problem. > > I've to read from a Webserver-logfile some text indicating what page have been > visited, and > tracking the querystring parameters. > > The problem is that in the logfile special chars are traslated in "web safe" format >

RE: How do i include a shell script

2003-10-29 Thread Stephen Hardisty
> How do i include a shell script in perl. I have to use some shell scripts in > a perl script. I know I can write it in perl, but would like avoid doing it > at this time, due to shortage of some time. You could execute them as you would any other program. This example uses backticks: `bob.sh`

RE: pattern matching

2003-10-27 Thread Stephen Hardisty
> SORRY! copy-and-paste-error...I tried it without the ### ;-) > and tried too the print-statement-thing. > Seems the regex is wrong, but why? > Jane Try: /^SA.+\n/ This email has been scanned for all viruses by the Message

RE: pattern matching

2003-10-27 Thread Stephen Hardisty
> Two questions: > I've got a test-file and want to add something to some lines, while > reading it out. > I tried the following code: > > while () { > if (/pattern/) { > #$line = $_ . $something; > #push (@new_array, $line); > } > else { > #$line

RE: Aliases in Perl?

2003-10-20 Thread Stephen Hardisty
> Hi, > > Are there 'aliases' in perl? For example, if I have a Korn shell script and > a function named "increaseCost()", I can do this: "alias > decreaseCose=increaseCost" (passing a parameter in). of course this is a > simplified example of what I want to do, but the point is to make > it

RE: array of arrays

2003-10-20 Thread Stephen Hardisty
Alright then, first you want to think about how you are going to populate the arrays. For example, if I have a file that contains the following data: 1|10 5|7 I would do this: open(FH, "< bob.txt"); my @file_list; while() { # add a reference of the 2 file columns to @file_list

RE: array of arrays

2003-10-20 Thread Stephen Hardisty
> How do I read data out of a table-file in an array-of-arrays? > > Problem: I have to compare two tables with pairs of start-stop-Positions. > I want to find out, which pair of Start-Stop-Position in table_1 > is > entirely within the range marked by a pair of start-stop-positions of > the seco

RE: lowercase

2003-10-20 Thread Stephen Hardisty
> Hi if i have an string lets say > $stri="Joana Prado"; > How do i transformm it into > "joana prado" > (all lowercase) > Thanks The lc function returns the lower case of a string: my $lower_case_string = lc($stri); This e

RE: if (-d .....

2003-10-08 Thread Stephen Hardisty
> Hi EVERYBODY, Hi Dr Nick > > i saw this "-d" switch in an "if" statement. > > if (-d $file) > > What does it mean, and are there more > this kind of switches and where can I find information about them. This will return 'true' is $file contains the location of a directory. More informa

RE: index

2003-10-01 Thread Stephen Hardisty
Oh, it all makes sense now. what are you going on about man? > Hi, > > > my $line = ; > chomp $line; > > my $first_space = index($line , " "); > > my $a = substr($line, 0, $first_space); > > > > my $last_space = rindex($line , " "); > my $b = substr($line, $last_space+1); > > > >

Re: perl query

2003-09-28 Thread Stephen Hardisty
There are loads of ways of doing this (Perl being what it is), but to help you with the grep, how did you call it within Perl? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Getting started in Perl for Windows

2003-09-25 Thread Stephen Hardisty
> When I am in a black command.com screen with CPAN> prompt, where am I? Why can't I cd to c:\? Because you're in the CPAN shell. You can ues this to download and install CPAN Perl modules. If you type: install Email::Find You can go back to the command prompt by typing 'exit' and get help by t

RE: Getting started in Perl for Windows

2003-09-25 Thread Stephen Hardisty
> If ppm doesn't work, try 'perl -MCPAN -s shell'. Oops, it's 'perl -MCPAN -e shell'. This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security s

RE: Getting started in Perl for Windows

2003-09-25 Thread Stephen Hardisty
Hi, it's 'Email::Find'. You can get information on this from: http://search.cpan.org/author/MIYAGAWA/Email-Find-0.09/lib/Email/Find.pm If ppm doesn't work, try 'perl -MCPAN -s shell'. Cheers! -Original Message- From: Dillon, John [mailto:[EMAIL PROTECTED] Sent: 25 September 2003 11:24 To

RE: Getting started in Perl for Windows

2003-09-24 Thread Stephen Hardisty
> Why should it? Desktops are for the least sophisticated users, only. Ooh, handbags! This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security

RE: Getting started in Perl for Windows

2003-09-24 Thread Stephen Hardisty
Hi, you need to give it some code to compile. Create a plain text file and put some code into it, for example: print "hello\n"; Save it somewhere. Then on the command line (the DOS thingy), cd to where you made this file and type: perl myperlscript.pl Where 'myperlscript.pl' is the name you'v

Re: determining type of referance

2003-09-23 Thread Stephen Hardisty
> Is there a test I can do to determine the type of reference that has > been created? > > ie. array of arrays, array of hashes, hash of hashes. > > I'm in a position where I didn't created the reference but still need to > access it. > Howdy, 'ref' function will return will return what you wan

RE: Elegant exit on the console

2003-09-23 Thread Stephen Hardisty
Afternoon, you could use Term::ReadKey, for example: use Term::ReadKey; # if you hit ctrl-c you still want to return to 'normal' $SIG{INT} = sub{ReadMode('normal')}; ReadMode('cbreak'); # 'ord' returns the ASCII value of a character # and 27 is th

Re: stop/start

2003-09-22 Thread Stephen Hardisty
> $SIG{ALRM} = { > `this-script`; > exit; > }; Sorry, didn't think it through (before anybody notices.). Remove the thing that executes the script (the bit in backticks) and just have the process start on a cron job. Tired, apologies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] Fo

Re: stop/start

2003-09-22 Thread Stephen Hardisty
Hi, you could write a handler for the signal alarm that starts a new process and kills the current: $SIG{ALRM} = { `this-script`; exit; }; At the beginning of the script set the alarm to go off 24 hours later: alarm(84600); DISCLAIMER: haven't really thought it through and it's really hac

RE: list-parsing problem

2003-09-18 Thread Stephen Hardisty
Two dimensional hash perhaps? Where the first column is the first dimension and the second is, well, the second. E.g. while() { ($col1, $col2) = split(/$delimeter/, chomp($_)); $blah{$col1}{$col2} = 1; } Hope this helps. _

Re: Split based on length

2003-09-17 Thread Stephen Hardisty
> for(split(/(..)/, $string)) { print "*$_" if $_; } Gorgeous :o) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Split based on length

2003-09-17 Thread Stephen Hardisty
Hi, you can use split for this sort of thing. For example: my $string = "hello there"; # add an extra '.' for every character you want my @pairs = split(/(..)/, $string); The only thing you want to be careful about is empty quotes/nothing (e.g. ''). For example, if we wanted to print the charac

RE: Conceptual -- Spam stopper script

2003-09-17 Thread Stephen Hardisty
You could try SpamAssassin (www.spamassassin.org). Quite effective rule based blocking. A lot (if not most) Spam emails come from real email addresses, they just don't belong to the guy that sent the email. For the Spammers that use their own email addresses (be it Yahoo or Hotmail etc.), if you