Re: newbie question about regex

2004-09-03 Thread David Dorward
On Fri, Sep 03, 2004 at 04:33:43PM +0200, Maurice Lucas wrote:
> $ ./count.pl /var/log/file text
> this works fine but sometimes the "text" is "foo(bar)" and then my scripts 
> gives an error.
> syntax error near unexpected token `foo(b'

That's a shell issue, not a Perl issue. Escape your brackets or
quite your text so that bash (or sh or whatever) won't try to
do something special with it.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: DBI for FireBird

2004-08-20 Thread David Dorward
On 20 Aug 2004, at 11:03, Cristi Ocolisan wrote:
Can anybody tell me something about a DBI for FireBird?
I looked on CPAN, but didn't find any.
When I go to <http://search.cpan.org/search?query=firebird&mode=all> 
the second hit is subtitled "DBI driver for Firebird" (then it goes on 
to mention InterBase).

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: can't locate Image/Magick.pm in @INC

2004-08-16 Thread David Dorward
On 16 Aug 2004, at 15:30, Brian Volk wrote:
I'm having trouble using Apache::ImageMagick.  Here is the error I'm
getting.
Can't locate Image/Magick.pm in @INC (@INC contains: C:\PROGRAM
FILES\PERLEDIT
C:/Perl/lib C:/Perl/site/lib .) at 
C:/Perl/site/lib/Apache/ImageMagick.pm
line 25.
Does Magick.pm existing in an Image directory in any of those 
directories? If not - install Image::Magick.

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: how to embed c code in perl programs

2004-08-13 Thread David Dorward
On 13 Aug 2004, at 08:16, Karthick wrote:
Is it possible to embed C/C++ codes into perl programs. (Actually I 
want to make use of an API, that could be used with with C).
You could try XS <http://www.perldoc.com/perl5.6/pod/perlxs.html> or 
Inline::C <http://search.cpan.org/~ingy/Inline-0.44/C/C.pod>. They both 
look like they should do the job, but I have to confess I haven't used 
either.

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: File Size Calculator

2004-08-09 Thread David Dorward
On 9 Aug 2004, at 14:34, SilverFox wrote:
Hi all, I'm trying to writing a script that will allow a user to enter 
a
number and that number will be converted into KB,MB or GB depending on 
the
size of the number. Can someone point me in the right direction?
What have you got so far? Where are you stuck? Getting user input 
(where from)? Working out which order of magnitude the number is? 
Converting between kilo and mega et al? Showing the output?

Show us some code.
--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Determining Odd and Even Numbers

2004-08-03 Thread David Dorward
On 3 Aug 2004, at 13:26, [EMAIL PROTECTED] wrote:
Does anyone know a simple way to determine if a number is odd or even?
Use the modulus operator. If $foo % 2 has remainder 1, then it is odd, 
if it has remainder 0, then it is even.

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Trouble with PERL and HTML

2004-07-25 Thread David Dorward
On Sun, 2004-07-25 at 19:17, renzo rizzato wrote:

> The requested URL /cgi-bin/index.html was not found on this server.

> For a reason I cannot understand, the system keeps to stay in the cgi-bin 
> directory, why?

You haven't shown any code, so I'm going to make a wild guess.

You have a link to "index.html" instead of "/index.html" or
"../index.html" or "http://www.example.com/index.html";.

-- 
David Dorward   <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Help required with DBI

2004-07-24 Thread David Dorward
On Sat, 2004-07-24 at 19:14, NandKishore.Sagi wrote:

> $data_source = "dbi:DriverName:database_name" ;
>  
> Can't locate DBD/DriverName.pm in

Change "DriveName" to the name of the driver you want to use (e.g.
mysql)

Change "database_name" to the name of the database you want to use.

-- 
David Dorward   <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Windows Perl Environment

2004-07-17 Thread David Dorward
On Sat, 2004-07-17 at 10:44, [EMAIL PROTECTED] wrote:
> Is there any program that allows one to write Perl scripts and and then test 
> them in a windows environment without using a DOS window,

ActivePerl and the WindowsXP cmd program. No DOS there.

What is wrong with command lines anyway?

>  and actually have me 
> see the program run before I upload it to a server, rather than just testing 
> if the script runs without errors? Anyone know what I mean and know of any 
> such program?

Do you mean a debugger which allows line by line execution? Perl has one
built in, I'd be surprised if ActivePerl removed it.

http://www.linuxjournal.com/article.php?sid=2484


-- 
David Dorward   <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: how to extract digit from a line in Perl

2004-07-14 Thread David Dorward
On 14 Jul 2004, at 11:00, Franklin wrote:
I want to extract the digit from a line of text. For exmple, for a 
text line: TSC2101Net, how can I write a script to extract 2101 and 
print it?
There are number of techniques that spring to mind, the obvious being 
regular expressions and substring. The latter isn't much good unless 
you know the position of the numbers in the string. The former is more 
flexible but also more complex.

perldoc perlrequick
perldoc -f substr
  IncrediMail - Email has finally evolved - Click Here
Evolved into a distracting blinking thing that gives me a headache. 
Eugh.

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: new window on redirect

2004-07-13 Thread David Dorward
On 13 Jul 2004, at 14:37, Tim McGeary wrote:
I want my web page redirect to open in a new window, as if I were 
putting "target=_new" in the html of the URL.
Which isn't allowed under HTML. You are probably thinking of _blank.
http://www.w3.org/TR/html4/types.html#h-6.16
How can I do that using CGI.pm's redirect?
print $output->redirect($u)
You can't... well... there is the Window-Target not-really-http-header 
but, last I heard, browser support for that (thankfully) sucks.
http://diveintoaccessibility.org/day_16_not_opening_new_windows.html

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Reading a comma delimited file into an array

2004-06-18 Thread David Dorward
On 18 Jun 2004, at 14:30, [EMAIL PROTECTED] wrote:
As a learning Perl Person, this is fun.  Would someone please point me 
in the
correct direction to read a comma delimited file and put it into an 
array?
http://search.cpan.org/~alancitt/Text-CSV-0.01/CSV.pm
http://search.cpan.org/~jwied/Text-CSV_XS-0.23/CSV_XS.pm

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Identifying words containing a specific substring in a sentence (was: a simple question)

2004-06-16 Thread David Dorward
Tip: This is a beginners list, therefore many questions will be simple. 
Aim for more descriptive subject lines and life will be easier for 
users of the list archives.

On 16 Jun 2004, at 17:10, Kevin Zhang wrote:
For the following string:
" axyzb  cxyzd "
What is the command to extract the substrings with "xyz" in them? In 
this case, I'd like to get two strings "axyzb" and "cxyzd".
The useful functions here are "grep" and "split" (perdoc -f grep and so 
on).

#!/usr/bin/perl
use strict;
use warnings;
my $string = " axyzb  cxyzd ";
my @list_of_words = split /\ /, $string;
my @list_of_words_containing_xyz = grep /xyz/, @list_of_words;
foreach my $word (@list_of_words_containing_xyz) {
print $word, "\n";
}
or, in less verbose form:
foreach (grep(/xyz/,split(/\ /, " axyzb  cxyzd "))) { print 
$_, "\n"; }

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: How to execute a Perl script in Linux??? (I havent seen linux)

2004-05-25 Thread David Dorward
On 25 May 2004, at 10:25, LRMK wrote:
I have never used a computer with linux so I need a very clear answer
I have a script uploaded to
/home/myusername/public_html/cgi-bin/rating/rank.pl
in my web host
I want it to execute once a week So I am gonna use Cron Jobs I can set 
the
timing its very simple
But I dont know what is the command to execute the above script.

perl /home/myusername/public_html/cgi-bin/rating/rank.pl
--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: My & local

2004-05-14 Thread David Dorward
On 14 May 2004, at 13:52, Asit Kumar wrote:
can u tell me what is diference between my & local in perl with 
example.
perldoc -q local my

Found in /System/Library/Perl/5.8.1/pods/perlfaq7.pod
   What's the difference between dynamic and lexical (static) 
scoping?
   Between local() and my()?

(You might have to scroll down a bit to find it though)

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: RegExp Help !

2004-05-10 Thread David Dorward
On 10 May 2004, at 17:42, <[EMAIL PROTECTED]> wrote:
Well need your help in framing a RegExp

I've to parse for the  tag in a HTML/ASP file and then when i 
get that i need
to get only yhe action filepath in to an array ! How do i do it ?
Parse::HTML would suggest itself rather then a regex.

For Example



i need only the "register/doregister.asp" in an array !
my $html = qq();
(my $action) = ( $html =~ /action=\"([^\"]*)\"/ );

Replace "my $action" when whatever array location you want to load it 
into.

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: installing DBI on HPUX

2004-05-10 Thread David Dorward
On 10 May 2004, at 11:44, Christian Stalp wrote:
I just tried to install the DBI-module for Perl.
Can't locate Test/More.pm
After that the make dosn't work either!
What can I do?
Install Test::More first.
(You might want to check out the CPAN module, which can be configured 
to auto-install dependancies for you)

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: OT question about Texinfo

2004-05-04 Thread David Dorward
On 4 May 2004, at 13:41, Gabor Urban wrote:
I know that my question is offtopic here, but can anybody inform me,
if there is a tool to convert Texinfo documentation to HTML?
Looking at the Texinfo homepage I see:
  texi2html, an (actively maintained) alternative translator
  for generating HTML, roff, and chm.
   - http://www.gnu.org/software/texinfo/
--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Directory Listing

2004-04-21 Thread David Dorward
On 21 Apr 2004, at 11:09, Ryan Thomas wrote:

I am relatively new at PERL and am learning it for a school project. 
What I would like to do is write a perl script that can run a complete 
directory listing including sub-directories and save the result to a 
text file.

Not sure where to start.
Take a look at File::Find (to recurse directories) and open (to open a 
handle you can print to to write to a file)..

perldoc File::Find
perldoc open
--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: perl book

2004-04-20 Thread David Dorward
On 20 Apr 2004, at 12:10, Prem Vilas Fortran M. Rara wrote:
--- Gabriel Striewe <[EMAIL PROTECTED]> wrote:
*"Programming Perl" by Larry Wall (the author of
Perl himself), Tom
Christiansen and Jon Orwant
any online version?
<http://safari.oreilly.com/>, which also has Learning Perl.

--
David Dorward
 <http://dorward.me.uk/>
<http://blog.dorward.me.uk/>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>