Re: problems with scalar(@array)

2002-12-17 Thread Chris Ball
 On Tue, 17 Dec 2002 11:59:46, [EMAIL PROTECTED] said:

Also, you might change 'scalar(@url)' to '$#url' for simplicity.
   
More than just simplicity:

   void:chris~ % perl -le '@a=(5,10,15,20); print scalar @a,\n,$#a'
   4
   3

$# signifies the index of the last element in an array - and since an
array is zero-indexed in Perl, that's always going to be one less than
the total number of elements in the array, which is what scalar(@array)
gives.  Using scalar(@array) as the upper bound in a for loop would give
an extra iteration of the for loop over a non-existant element with the
index $array[$#array+1].  So don't do that.  :-)

- Chris.
-- 
$a=printf.net;  Chris Ball | chris@void.$a | www.$a | finger: chris@$a
|  Q. How do you tell an extrovert techie from an introvert techie?
|  A. He looks at your feet rather than his own.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: crypt()

2002-12-08 Thread Chris Ball
 On 8 Dec 2002 07:22:39, Jerry M. Howell II [EMAIL PROTECTED] said:

I used the useradd -p and it doesn't insert the passwd like it
should I should see something like $1$blahhblahhblahh but it
doesn't do this, if I manualy insert it it works fine but it looks
like print `/usr/sbin/useradd $username -p $pwd`; screws it up

You've been using the wrong hashing algorithm, I'm afraid.  crypt()
isn't used in modern UNIX password files, md5 is.  I think your code
will start working if you use:

   use Crypt::PasswdMD5; 
   $pass = unix_md5_crypt($input_pass,$salt);

Also, your double-quotes in the useradd command look redundant.  Try
removing them, if it still doesn't work.  They may been being processed
as part of the username/password.

Hope this helps,

- Chris.
-- 
$a=printf.net;  Chris Ball | chris@void.$a | www.$a | finger: chris@$a


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: use warnings; and #!/usr/bin/perl -w

2002-11-26 Thread Chris Ball
 On 26 Nov 2002 09:57:44, Dylan Boudreau [EMAIL PROTECTED] said:

Is use warnings; the same as #!/usr/bin/perl -w

Good question.  They're similar, but 'use warnings':

-  only works under Perl 5.6+
-  works _lexically_, rather than globally
   - this means that you can do this:

 package main;
 code_that_emits($warnings);

 package two;
 use warnings;
 code_that_emits($warnings); # warning is given here, but not above

- allows you to choose what you see warnings on
   - this also works in reverse, so you could:

 no warnings uninitialized;

   .. and you wouldn't see initialization warnings in that scope.

Hope this helps.  perldoc perllexwarn for some more..

- Chris.
-- 
$a=printf.net;  Chris Ball | chris@void.$a | www.$a | finger: chris@$a


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: a question about output

2002-11-24 Thread Chris Ball
how can I output first line\n and last line\n to the screen
but save the result of system command ls to a file(eg
result)(not appear on the screen)?

 On 24 Nov 2002 23:42:50, Jeff 'japhy' Pinyan [EMAIL PROTECTED] said:
Unbuffer STDOUT:
  $| = 1;
See 'perldoc perlvar' for information about the $| variable.

This doesn't help with storing the output from ls to a file rather than
STDOUT, which should be done with something like:

   open(FILE, result) or die $!;
   print FILE `ls`;
   close FILE;

- Chris.
-- 
$a=printf.net;  Chris Ball | chris@void.$a | www.$a | finger: chris@$a


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Advice wanted on project

2002-11-23 Thread Chris Ball
 On Sun, 24 Nov 2002 01:13:52, Steve Gross [EMAIL PROTECTED] said:

4) Are there any call tracking/help desk systems out there to look
at?  Thanks for any help.

Request Tracker[1] is a *very* featureful ticket tracking system using
HTML/CGI as a front-end to a database.  I've used it backing on to both
MySQL and Postgresql.  It handles high load very well given a decent
spec machine.

RT is, like MySQL or Postgres, free both in usage and availability of
source code.  There's a company formed behind it to provide support and
customisations if necessary.

- Chris.
  [1]:   http://www.bestpractical.com/rt/ .
-- 
$a=printf.net;  Chris Ball | chris@void.$a | www.$a | finger: chris@$a
|   Banks use perl?  Let me take my $money out.
|   Only banks for rich people.  Banks for people like you use COBOL.
| -- gale:[EMAIL PROTECTED], 2002-08-26.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Anyone know what Perl Jaguar is coming with?

2002-08-16 Thread Chris Ball

 On Thu, 15 Aug 2002 19:26:39 -0400, Eric  Plowe [EMAIL PROTECTED] said:

   EP Jaquar is shipping with 5.8.0 
   EP ~Eric

The Mac OS X perl list (where this thread started) disagrees with you,
and seems to think that it's shipping with 5.6.0 as before.  How recent
is your information?

http://archive.develooper.com/macosx%40perl.org/msg02650.html

- Chris.
-- 
$a=printf.net;  Chris Ball | chris@void.$a | www.$a | finger: chris@$a


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: What Modul for use with imap?

2002-07-29 Thread Chris Ball

 On Mon, 29 Jul 2002 11:40:04 +0200, Angerstein [EMAIL PROTECTED] said:

   ang Hello, I have a short Question, which module can I use to work
   ang with imap-email?

Net::IMAP, Net::IMAP::Simple, Mail::IMAPClient.  Whichever you want.

In future, you can answer questions like these with CPAN's search
functions.  I prefer the interface at  http://search-beta.cpan.org/ .

- Chris.
-- 
$a=printf.net;  Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 Blessings to the chap who invented ice cream, ginger-pop and the rest!
 I'd rather invent things like that any day than rockets and bombs.
   -- Julian, Five on Finniston Farm


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: search and replace problem

2002-07-11 Thread Chris Ball

 Shaunn == Shaunn Johnson Johnson writes:

Shaunn But nothing is happening (that I can see).  What am I doing
Shaunn wrong?

This is a FAQ.  

Your code seems fine in as far as it goes - it iterates through files,
and modifies $_ with a regular expression occasionally.  Here's the
problem, though:

  Changes to $_ inside an FD are _not_ reflected back to a file.

You can read 'perldoc -q How do I change one line in a file' for
the suggested ways of doing modifications like this.

Hope this helps,

- Chris.
-- 
Chris Ball | [EMAIL PROTECTED] | +44 207 677 2305


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Modules

2002-07-06 Thread Chris Ball

 John == John Almberg [EMAIL PROTECTED] writes:

John Now that is a handy little script. Thanks!  I have a related
John question . . . where does @INC come from? I guess there is a
John configuration file somewhere?

It's compiled into perl itself, I believe.  You can manipulate it in
script with the use lib ; pragma or changing the bang-line to include
-Idir.  Outside of your script, you can manipulate the PERLLIB or
PERL5LIB environment variables.

- Chris.
-- 
$a=printf.net;  Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 Blessings to the chap who invented ice cream, ginger-pop and the rest!
 I'd rather invent things like that any day than rockets and bombs.
   -- Julian, Five on Finniston Farm


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CPAN viruses

2002-06-05 Thread Chris Ball

 Patrick == Patrick Griffin [EMAIL PROTECTED] writes:

Patrick Hello: Just downloaded my first CPAN module (woo-hoo).
Patrick What risks are associated with installing these modules?

In theory, many.

Patrick Are they checked for viruses, etc. before posting?

Nope.  If you're using the CPAN installer, they'll be checked against
the checksum list - you can be sure that you're installing the same file
that was uploaded to the server by the developer.  However, there's
nothing to stop anyone uploading a script that runs 'rm -rf /' and
getting you to type 'perl -MCPAN -e 'install Helpful::Script'' - it's
trivial to get a CPAN account, and new uploads aren't vetted.

In theory, though, it's likely that such a module would be noticed very
quickly indeed, and removed of anything harmful.  Hopefully.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 chris@lexis:~$ perl -le'@a=($^O eq 'darwin')?qw(100453 81289 9159):qw
 (23152 19246 2040);while(){chomp;push @b,$_ if grep {$.==$_}@a}push
 @b,$^X;print ucfirst join( ,@b[2,0,3,1]).,'/usr/share/dict/words


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to use crypt ??

2002-05-23 Thread Chris Ball

 David == David vd Geer Inhuur tbv IPlib [EMAIL PROTECTED] writes:

David Trying to use crypt() to encrypt a given password.  I know
David how to compare a given password with an encrypted one, but to
David encrypt one myself and save it, doesn't work for me for some
David reason.

Japhy has a page explaining crypt(), which should clear everything up
for you.  It's on-line at:  http://www.crusoe.net/~jeffp/docs/crypt

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 chris@lexis:~$ perl -le'@a=($^O eq 'darwin')?qw(100453 81289 9159):qw
 (23152 19246 2040);while(){chomp;push @b,$_ if grep {$.==$_}@a}push
 @b,$^X;print ucfirst join( ,@b[2,0,3,1]).,'/usr/share/dict/words


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: equivalent of /* */

2002-05-21 Thread Chris Ball

 Eric == Eric Wang [EMAIL PROTECTED] writes:

Eric newbie question: what's the equivalent of /* */ as in C++ in
Eric PERL??

There isn't one.  Some people might disagree, but hear me out.  :-)

There are two ways of doing something similar, but not identical.  
The first, and one you're most likely to use is '#', for example:

   print $bar unless @foo  2; # print $bar unless @foo has more than
   # two elements.

However, this isn't /**/.  It only works to the end of the current line.

The second, which is more equivalent to /**/, is '=cut'.  It's part of
Perl's documentation format, POD, which you can read about in 'perldoc
perlpod'.  It isn't entirely like /**/, in that you have to put it
at the start of a new statement.

It's used like this:

   print 1..3;

   =cut
   print 4..6;
   =cut

   print 7..9;

(prints '123789')

Hope this helps,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 chris@lexis:~$ perl -le'@a=($^O eq 'darwin')?qw(100453 81289 9159):qw
 (23152 19246 2040);while(){chomp;push @b,$_ if grep {$.==$_}@a}push
 @b,$^X;print ucfirst join( ,@b[2,0,3,1]).,'/usr/share/dict/words


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: FIle upload

2002-05-20 Thread Chris Ball

 arran == arran ubels Arran writes:

arran I cant get a sucessfull file upload in ActivePerl i have
arran tried many ways,,, can someone send me a sucessfull example?

First up, I really hate your sig.  ;-)

Second, use CGI::Upload from the CPAN.  It has example uses in its own
documentation, reprinted here:

 use CGI;
 use CGI::Upload;

 my $cgi = CGI-new;
 my $upload = CGI::Upload-new( $cgi );

 my $file_name = $upload-file_name( 'field_name' );
 my $file_type = $upload-file_type( 'field_name' );

 $upload-mime_magic( '/path/to/mime.types' );
 my $mime_type = $upload-mime_type( 'field_name' );

 my $file_handle = $upload-file_handle( 'field_name' );

If you have problems with this, see the module's documentation, or ask
us if you can't figure it out.  Bear in mind that many problems may be
related to your webserver's CGI setup, and not to Perl itself at all.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 chris@lexis:~$ perl -le'@a=($^O eq 'darwin')?qw(100453 81289 9159):qw
 (23152 19246 2040);while(){chomp;push @b,$_ if grep {$.==$_}@a}push
 @b,$^X;print ucfirst join( ,@b[2,0,3,1]).,'/usr/share/dict/words


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: help!

2002-05-18 Thread Chris Ball

 Haitham == Haitham N Traboulsi [EMAIL PROTECTED] writes:

Haitham Here is an example that illustrates my task.  imagine that
Haitham we have got this list or array which contains some
Haitham consecutive numbers e.g. (1, 2, 3, 4, 6, 8, 34, 50, 51, 52,
Haitham 60, 66, 67, 68) and I want to locate just the consecutive
Haitham numbers included.  I would appreciate any help with this
Haitham problem.  thanks alot

Hi,

This reminds me a great deal of a problem about compacting a list from a
while back.  Your new homework can be to convert that solution to your
task.  :-)

The post I'm thinking of is at:

   http://archive.develooper.com/beginners%40perl.org/msg16089.html

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: the homework assignment problem

2002-05-18 Thread Chris Ball

 Cathy == CATHY GEAR (TRUST HQ) [EMAIL PROTECTED] writes:

Cathy But sometimes I don't hold out much hope as I don't
Cathy understand the significance of foo or bar!

foo and bar are 'meta-syntactic variables'; variables names that we use
when describing how programs work, to show that we're talking about
something that could be any variable.  You can read about them at:

   http://www.tuxedo.org/jargon/html/entry/metasyntactic-variable.html

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: urandom

2002-05-16 Thread Chris Ball

 Postman == Postman Pat [EMAIL PROTECTED] writes:

Postman Greetings, I would like to create get some random stuff
Postman using /dev/urandom. What I was thinking is using stuff from
Postman urandom as the random seed and using the normal rand stuff
Postman from perl?

Postman Any ideas how I could code this, or is there a better way
Postman of actually getting random stuff.

Someone beat you to it.  :)  The Crypt::Random CPAN module is an
interface to /dev/random (and /dev/urandom).

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perldoc

2002-05-16 Thread Chris Ball

 Robert == Robert Hanson [EMAIL PROTECTED] writes:

 If I wanted information on declaring variables using perldoc how
 would I find it.  perldoc perldoc is no use.

Robert The perldoc manpage is about the perldoc
Robert utility... perlpod talks about the Plain Old Documentation
Robert (pod) format.

I don't think this is what Harry's after, though his question is worded
badly; I think he wants to know how to find particular topics in perldoc
rather than how to write POD.

If this is the case, the perldoc page containing the table of contents
for perldoc is found with:  perldoc perltoc

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perldoc

2002-05-16 Thread Chris Ball

 Harry == Harry Jackson Jackson writes:

Harry perldoc perl perldoc perltoc

Harry These where just what I was after. Its hard to believe I have
Harry been rummaging around in Perl for a few weeks and only
Harry realised they where on my system yesterday. Cheers for all
Harry the replies.

I've submitted a documentation patch on this and it's been applied to
the 5.8 tree.  There'll be mention of perltoc as a good place to start
on the `perldoc perldoc` page in that release.

Hope this helps,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: SFTP

2002-05-15 Thread Chris Ball

 Shaun == Shaun Fryer [EMAIL PROTECTED] writes:

Shaun Does anyone know off hand if there is a Perl Module for
Shaun negotiating and scripting SFTP connections?

Yes, Net::SFTP.  You could have found this out by typing 'sftp' into the
search box at http://search.cpan.org.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: TIMTOWTDI

2002-05-12 Thread Chris Ball

 jn == josenyimi [EMAIL PROTECTED] writes:

jn The task is simply to upercase the first char of a given string
jn and lowercase the rest.

$string = ucfirst lc $string;

Nice try, though.  :-)

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Pattern Matching...

2002-05-09 Thread Chris Ball

 Scott == Scott Batchelor Batchelor writes:

Scott $pair=~m/([^=]+)=(.*)/)

Scott This basically says start at the beginning of the string and
Scott match any = all the way to the end of the string...right?

No, I'm afraid not.

You can get an English explanation of a regexp with Japhy's excellent
YAPE::Regex::Explain module.  Here's the output for your code:

NODE EXPLANATION
--
  /'/'
--
  (group and capture to \1:
--
[^=]+any character except: '=' (1 or more
 times (matching the most amount
 possible))
--
  )end of \1
--
  ='='
--
  (group and capture to \2:
--
.*   any character except \n (0 or more times
 (matching the most amount possible))
--
  )end of \2
--
  /'/'
--
)end of grouping
--
void:chris~

Hope this helps,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
Never go in against a Sicilian when _death_ is on the line! - Vizzini


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Script Versioning

2002-05-04 Thread Chris Ball

 Kevin == Kevin Old [EMAIL PROTECTED] writes:

Kevin How am I to version the scripts while I am developing it?

The versioning scheme that many large projects such as Perl and the
Linux kernel use is one of:

major.minor.patch

So, for example, one of the versions of Perl installed on this machine
is 5.7.2.  That's major release 5 - major releases in Perl tend to break
backwards compatibility a little, have big code rewrites, new builtins
and semantics, that sort of thing.  This versioning scheme _also_ shows
how stable the product is; which, for me, is one of the most important
things for a versioning scheme to do.  Whether the minor release number
is even/odd displays whether the release is considered stable/unstable.

Kevin How often do I change versions?

'Change versions' whenever you make a source change.  Change patchlevel
if it's a tiny and inconsequential fix, change minor whenever something
important has changed and you want people to be aware of that, change
major when you're breaking interfaces and compatibility all over the
place.  Keep below version 1.0 until your code does something useful,
and is stable and working as it should in what it does.

Just some ideas,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
Never go in against a Sicilian when _death_ is on the line! - Vizzini


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: I want to make sure I get this right

2002-05-02 Thread Chris Ball

 Tanton == Tanton Gibbs [EMAIL PROTECTED] writes:

Tanton I'm writing an academic paper in which I used Perl...so I
Tanton want to make sure I get the names right.  If I'm talking
Tanton about the perl interpreter I use lower case like I just did.
Tanton But, if I'm talking about the Perl language, I use an
Tanton uppercase P like I just did...is this correct?

Yes.

See perlfaq1 for clarification, paste enclosed.

- Chris.

Found in /usr/share/perl/5.6.1/pod/perlfaq1.pod
   What's the difference between perl and Perl?

   One bit.  Oh, you weren't talking ASCII? :-) Larry now
   uses Perl to signify the language proper and perl the
   implementation of it, i.e. the current interpreter.  Hence
   Tom's quip that Nothing but perl can parse Perl.  You
   may or may not choose to follow this usage.  For example,
   parallelism means awk and perl and Python and Perl
   look OK, while awk and Perl and Python and perl do
   not.  But never write PERL, because perl isn't really an
   acronym, apocryphal folklore and post-facto expansions
   notwithstanding.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Parameters

2002-05-02 Thread Chris Ball

 Josef == Josef E Galea [EMAIL PROTECTED] writes:

Josef How can I pass parameters (eg: a file name) to a Perl script

If you mean via the console, parameters (or 'arguments') magically end
up in the @ARGV array, which you can access inside your script.  An
example of this would be (from the top of my head):
   
   #!/usr/bin/perl -w
   use strict;

   if (@ARGV != 2) {   # if we don't have two arguments
  print 'Usage: perl $0 arg1 arg2\n';
  exit;
   }

   $argument1 = $ARGV[0];  # note that arrays are zero-indexed
   $argument2 = $ARGV[1];

   # make sure that $argument{1,2} don't contain special chars
   $argument1 =~ s/[^A-Za-z0-9:\.]//;
   $argument2 =~ s/[^A-Za-z0-9:\.]//; 

   do_something_with($argument1, $argument2);

Hope this helps,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Problem accessing the command line arguments

2002-05-02 Thread Chris Ball

 Sailaja == Sailaja Gudipati [EMAIL PROTECTED] writes:

Sailaja myscript.pl -f test.txt

Sailaja if($#ARGV  2) { print $USAGE; }

$# returns the _last element index_ in the array.  As I pointed out in
my last mail, array indexes are zero-indexed, not one-indexed.  Your if
conditional will only become true on _three_ or more arguments.

Sailaja BTW, what is this $USAGE.  I saw it in some books and just
Sailaja copied here.  Please let me know how to use $USAGE also.

$USAGE isn't a special variable.  If you want to use this code, you'll
have to define $USAGE to be a string telling the user how many variables
to pass, such as:

$USAGE = '$0 var1 var2';

Sailaja if($ARGV[0] !~ /-f/) print Wrong switch; 

This looks fine, though you need braces around the print statement.
Also note that 'foo-fbar' matches this regexp.  I'd use:

if ($ARGV[0] ne '-f') { print Wrong switch; }

Sailaja if($ARGV[1]) !~ //) print Empty file name not allowed;

This doesn't make sense.  You're saying If the second argument is not
equal to nothing, then print an error saying that the second argument
should be not equal to nothing..  The correct line would be:

if ($ARGV[1]) =~ //) { print Empty file name not allowed; }

in your style, or:

   unless ($ARGV[1]) { print Empty file name not allowed }

should work just fine.  _However_, this is already being picked up by
your check on the number of elements in @ARGV, since an empty string
won't appear as an array element.

Sailaja But, since @ARGV is empty, I am unable to validate the
Sailaja command line arguments.

The errors are with your code, rather than the population of @ARGV, in
my opinion.  There are certain situations where both could be the case,
though, as someone else described for Windows.

Hope this helps,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Cygwining off Re: perlcc - newbie - cannot compile successfully - sample sessio n

2002-04-20 Thread Chris Ball

 Robert == Robert Citek [EMAIL PROTECTED] writes:

Robert Some CPAN modules/tarfiles have filenames that have two
Robert colons in them, e.g. foo::bar.  While this works fine under
Robert Unix/Linux, Windows complains.  I believe MacOS 9 would balk
Robert about this, too.  Not sure about darwin/MacOS X.

No, that's not true.  Hierarchies are represented by directories on the
CPAN - for example, for the Some::Module module, the hierarchy might be:

Some-Module-0.01.tar.gz:
Some/
Some/Module.pm

It's certainly the case with my CPAN modules, and any others that I've
seen.  For example, in my /usr/local/lib/perl5/5.7.2/ directory:

lexis:chris~ % cd /usr/local/lib/perl5/5.7.2/
Attribute/ Exporter/  List/  Search/
B/ ExtUtils/  Locale/Switch/
CGI/   File/  Math/  Term/
CPAN/  Filter/Memoize/   Test/
Carp/  Getopt/NEXT/  Text/
Class/ I18N/  Net/   Tie/
Devel/ IO/Pod/   Time/
Encode/IPC/   Scalar/User/

Each of these directories would contain the modules under that
namespace; for example, in Text/:

lexis:chris...perl5/5.7.2/Text % ls
Abbrev.pm   Balanced.podSoundex.pm  Wrap.pm
Balanced.pm ParseWords.pm   Tabs.pm

Hope this helps.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Is anyone using the Google API?

2002-04-20 Thread Chris Ball

 Tara == Tara Calishain [EMAIL PROTECTED] writes:

Tara I'm having a problem understanding how to parse what Google
Tara spits out.

I was wondering whether it would be worthwhile creating a CPAN module -
something like WWW::Google::SOAP - to allow simple searches with the
SOAP API, returning a nice hash.  Looks like it might be..

Tara I don't know whether to start looking for this information in
Tara the Google API docs, the SOAP::Lite docs, or if I've asked
Tara something so danged stupid the answer's not written down
Tara anywhere.

I don't think it's dumb.  It looks like the answers might be in some
reference hanging from $result, but I've no idea.  I don't know where
you'd look, either.  

Google has their own newsgroup for all of this; you might have more luck
posting to 'google.public.web-apis' through http://groups.google.com.

Hope this helps,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Is anyone using the Google API?

2002-04-20 Thread Chris Ball

 Me == Chris Ball [EMAIL PROTECTED] writes:

Me I was wondering whether it would be worthwhile creating a CPAN
Me module - something like WWW::Google::SOAP - to allow simple
Me searches with the SOAP API, returning a nice hash.  Looks like
Me it might be..

... and it also looks like someone else (a fellow london.pm'er, in fact)
beat me to it.  Leon Brocard has written a WWW::Search::Google with SOAP
support, which would allow you to use the much less wieldly:

  use WWW::Search;
  my $search = WWW::Search-new('Google', key = $key);
  $search-native_query(leon brocard);
  while (my $result = $search-next_result()) {
  print $result-title, \n;
  print $result-url, \n;
  print $result-description, \n;
  print \n;
  }

It's at:  http://www.astray.com/tmp/WWW-Search-Google-0.17.tar.gz

... and you'll need to install it with the usual 'perl Makefile.PL 
make  make test  make install'.  It's not on the CPAN, I believe,
because Leon wants to okay it with Google first; since they asked for
the original WWW::Search::Google to be removed.

Hope this is _more_ helpful,  ;-)

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Funny character on a dir name.

2002-04-18 Thread Chris Ball

 Yanet == Yanet Leon, [EMAIL PROTECTED] writes:

Yanet Not necessarily a perl question.  One of the users (on a Unix
Yanet box) created a directory with a dash at the beginning of the
Yanet name (no idea how he did it) and he needs to remove it.  The
Yanet name of the file is -testing is there a way to remove it
Yanet using perl or other means.  I removed it using the inode
Yanet number of the directory.  Is there another way?

Yup. rm -- -testing.  If you read man rm, you'll see that '--' signifies
the end of switches, so it knows whatever follows is a path to a file.

But this really is very off-topic.  :-)

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Convert Number In Strings to Numeric Form

2002-04-15 Thread Chris Ball

 Mok == Mok T Y [EMAIL PROTECTED] writes:

Mok Hi, I need some help in converting strings that contain numbers
Mok back into numeric form. Apparently, when I sort string
Mok formatted number, the arrangement was according to alphanumeric
Mok order (eg. 1, 10,11,2,20,21,3,30... ).  Thanks, TY

Since Perl doesn't make your declare your variables' type when you
create them, you need to tell it what kind of data you have when you use
the variable.

In this case, you're sorting lexically rather than numerically.  Use a
sort function like:

  @results = sort {$a = $b} @array; # an ascending numerical sort.

instead of:

  @results = sort @array; # which is equal to sort {$a cmp $b} @array.

The difference is '=' (numerical comparison) against 'cmp' (lexical
comparison).

Hope this helps.  perldoc -f sort for more information.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Executing Shell Commands

2002-04-15 Thread Chris Ball

 Matt == Matt Fuerst [EMAIL PROTECTED] writes:

Matt How do I execute a shell command in perl?

With the backtick operator:

$result = `ls`;

Matt Also I want to check the return status of the shell command,
Matt can I just assign a variable to it and check to see the value
Matt of the variable once the command is complete?

Sort of.  The backtick operator returns the output of the process,
rather than a return code.  For that, we have the system() function.

$return_code = system('ls');

Hope this helps.  perldoc -f system for more.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: command line arguments

2002-03-06 Thread Chris Ball

 Nikola == Nikola Janceski [EMAIL PROTECTED] writes:

Nikola Is there a way to get the command line arguments before they
Nikola are expanded by the shell?

Nope.  Perl simply doesn't get to see them.  It's part of your
interaction with the shell.

Nikola I know I can put it in quotes but is there any other way
Nikola around it?

Not as far as I know.  'script.pl file1\* \*file2\*' will pass them
untouched, if you have access to what's happening at the shell level.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Still can't extract data using HTML::TokeParser

2002-02-25 Thread Chris Ball

On Mon, Feb 25, 2002 at 02:29:58PM +1030, Daniel Falkenberg wrote:
 my $content = $response-content;
 $p = HTML::TokeParser-new($content) || die Can't open: $!;
 while ($stream-get_tag(h1)) { $data = get_trimmed_text(/h1);}

To start with, I think I'd use LWP::Simple.  It saves a lot of hassle.

use LWP::Simple;
$content = get($address) or die;

... would work to stick the HTML from $address in $content.

There's also an error in the above.  You're creating an instance of
TokeParser as $p, and then calling the 'get_tag' method on _$stream_,
which you haven't used before.  I used $stream in my original code
example; because I prefer variables that mean something, and that's how
I like to think of the TokeParser object.

Changing $stream to $p (or changing your instance of TokeParser to
$stream) should fix things.  I'd also switch to LWP::Simple, but that's
up to you.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 1 is equal to 2 for sufficiently large values of 1.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: What would take care of this?...

2002-02-22 Thread Chris Ball

 Daniel == Daniel Falkenberg [EMAIL PROTECTED] writes:

Daniel Would I now have to go ahead and use HTML::parser or
Daniel something of similar nature to extract headings?

Yeah, go with HTML::TokeParser.

Daniel !DOCTYPE HTML PUBLIC -//IETF//DTD HTML//EN
Daniel HTMLHEADTITLEGet all data from H1/TITLE /HEADBODY
Daniel BGCOLOR=FFh1I want all if this data extracted from
Daniel heading 1 (h1)/h1 /BODY/HTML

while ($stream-get_tag(h1)) { $data = get_trimmed_text(/h1); }

(Also see perldoc HTML::TokeParser, once it's installed.)

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: What would take care of this?...

2002-02-22 Thread Chris Ball

 Jonathan == Jonathan E Paton [EMAIL PROTECTED] writes:

Jonathan /h1([^]*?)\/h1/

Please don't ever try and parse HTML with regexps - I've had to work
with way too much code that did.  There are many situations where your
regex would break, and the TokeParser code wasn't much longer. It's
effectively impossible to parse HTML accurately with regexps.

- Chris.  
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: file size

2002-02-22 Thread Chris Ball

 Anthony == awards  anthony writes:

Anthony Hi, I have an upload script, and i want to check the file
Anthony size before it uploads.

The stat() function returns a list that includes file size as the
seventh element.  You can use:

   $size = (stat($filename))[7]; 

... to retrieve the size of $filename in bytes.

More information at perldoc -f stat,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl calling Visual Basic

2002-02-22 Thread Chris Ball

 chris == chris  [EMAIL PROTECTED] writes:

chris @result = `myCompiledVBApp AnyArgs`;
chris Anyone think I have lost my mind, or did I get one right???

Close.  I don't see why you're passing the return to an array rather
than scalar (@ rather than $), since it should just be an integer.
You're also capturing the output of the program when you use backticks,
rather than the return code, which is captured using system().

To execute and capture the return code of a program, I'd use:

  $return_code = system('program');

... but that assumes that the 'program' is something that can be entirely
executed from the command line and returns a useful return code - I
don't have familiarity with VB, but my short experiences seem to suggest
that this would be rare.

*awaits correction from Japhy*  :-)

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Web Address for Archives

2002-02-18 Thread Chris Ball

 terri == terri harrison [EMAIL PROTECTED] writes:

terri Is there a web address to search archived messages for this
terri list?

Certainly is.  It's at:
http:[EMAIL PROTECTED]/

If your browser is anything like mine, this might need to be re-encoded:
http://archive.develooper.com/beginners%40perl.org/

Hope this helps,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Urgent - Getting the left most 3 characters from a string...

2002-02-14 Thread Chris Ball

 chris == chris  [EMAIL PROTECTED] writes:

chris if left($result,3) = 500 Then Do whatever Else Blah Blah
chris Blah End If

if (substr($result,0,3) == 500) { do(stuff); } else { do(more_stuff); }

Note the arguments to substr are the start position (0 - the first
digit) and the range (three digits), and note the == to make a
comparison rather than an assignment.

Hope this helps,

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: A few Great Modules

2002-01-20 Thread Chris Ball

On Sun, Jan 20, 2002 at 08:06:51AM -0800, Matt C. wrote:
 This is a small list of Great Modules which have REALLY helped me 
 recently. I figured I would share a few. 

Matt,

I really enjoyed this post.  Does anyone else want to share some CPAN
modules or techniques they've found useful recently?

My plaything of recent times is Leon Brocard's GraphViz.pm module, which
allows you to graph from perl.  There's also a GraphViz::DBI, which
simply takes a DBI connection and snarfs table/relationship details from
the database before outputting a graph showing tables and the links
between them.

I'm also still an HTML::TokeParser geek.  TokeParser allows you to grab 
the contents of HTML tags, even if there's a complex structure to the
page defining which tags you want to take and which you don't.  

Hope either of these spark someone's interest.

- Chris.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: USE IMPORT REQUIRE

2002-01-06 Thread Chris Ball

On Sun, Jan 06, 2002 at 02:17:50PM +0330, nafiseh saberi wrote:
 what is the difference between 
 use , import , require.

See 'perldoc -q use require'.  'import' is not a perl keyword, and I'm
guessing that you got it from looking at Python source somewhere.  It
does have a use in perl, but as a special subroutine name; described in
perldoc -f import.  'import Some::Module' is not valid perl code.

Hope this helps,

- ~C.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: database to mail

2001-12-24 Thread Chris Ball

On Mon, Dec 24, 2001 at 01:40:35AM -0500, Fred Sahakian wrote:
 One of the arrays contains HTML paragraph symbols ( P ) which I do
 not want to appear in the e-mail that is sent out.  Any ideas?

I'm assuming you mean array literally, in which case all you need is:

map { $_ =~ s/p//ig } @array; # Remove (p|P) for each array element.

Hope this helps.  Merry Christmas, list!

- ~C.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: summarizing a list of numbers?

2001-12-17 Thread Chris Ball

On Mon, Dec 17, 2001 at 01:19:43PM +0100, Kredler Stefan wrote:
 I want to transform a sorted list into a compact list (if this is the
 correct term). 
 e.g. my list is 
 
 9,11,12,13,14,23,25,26,27,50  and want to have something like
 9,11-14,23,25-27,50   (to pass on to a unix-command).
 
 Is there any module or function I can use to summarize or compact this?

Don't know.  I decided that this was the sort of thing I shouldn't have
any problem in writing, though, and ended up spending most of my lunch
break on it.  It seems to work for the sort of data you gave:

void:chris~ % perl compact.pl 9 11 12 13 14 23 25 26 27 50
9,11-14,23,25-27,50

I'd be really interested to see if anyone can come up with a better way
of doing this; one that doesn't have to keep state, or uses recursion.
I'll bow down to anyone who can make a one-liner of it, naturally.

Hope this helps - out of interest, what sort of UNIX command _needs_ a
list like that instead of an explicit one?

- ~C.

void:chris~ % cat compact.pl
#!/usr/bin/perl -w
# Author:   Chris Ball [EMAIL PROTECTED]
# Function: Provide a 'compact list' for an array of numbers.
# Also at:  http://printf.net/compact.pl

my @approx = @ARGV;
my ($i, $inrange, $start, $end, $more);

use strict;

# Overview:
#  - Loop through the array.
#  - If the element after current matches (cur+1):
#-  Extend a range if we're in one.
#-  Set up a range if we aren't. 
#  - If the element after current _isn't_ (cur+1):
#- Mark/print the end of a range, or
#- Print a number on its own if we weren't in a range.
#  - If the element after current just doesn't exist at all:
#- Finish off a range or number tidily.

map { # Loop through the array, using $_.
my $cur= $approx[$_];
my $next   = $approx[$_+1] if defined $approx[$_+1];

if ($next) { # Is there an array element after this one?
if ($next != ($cur + 1)) {
# If the next element _isn't_ current+1.. 
if ($inrange) {
# If we're in a range, it needs to be finished. 
print $start-$end,;
$inrange = 0;
}
else {
# We're not in a range. 
print $cur,;
}
}
else {
# If the next array element is cur+1. 
if ($inrange) {
# If we're already in a range, extend it by 1. 
$end++;
}
if (not $inrange) {
# We're not in a range.  Set start/end/inrange.
$start   = $approx[$_];
$end = $approx[$_+1];
$inrange = 1;
}

}
}
else {
# It's the last element.  Make things look tidy.
if ($inrange) {
print $start-$end\n;
}
else {
print $cur\n;
}
}
} 0..$#approx
# -- end.

-- 
Chris Ball E-mail: [EMAIL PROTECTED]
Web Engineer   Web   : www.fast.no
Fast Web Media Ltd Try   : www.alltheweb.com 
12th Floor Sunlight House, Quay Street, Manchester M3 3JZ, UK.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: summarizing a list of numbers?

2001-12-17 Thread Chris Ball

On Mon, 2001-12-17 at 15:16, Jeff 'japhy' Pinyan wrote:
 There are two approaches.  One of them is the computer science way, and
 the other is the diehard-regex-hacker way.  I'll show you both (the regex
 way requires Perl 5.6, by the way).

I didn't even think of using regexps.  And you called _me_ a regexp
master yesterday.  Sigh.

I wrote:
  I'll bow down to anyone who can make a one-liner of it, naturally.

 It reduced a sizeable algorithm down to one simple regex: 
   s/\b(\d+)(?:,((??{1+$+})\n))+/$1-$+/g;

fx: Chris bows deeply and respectfully

- ~C.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: summarizing a list of numbers?

2001-12-17 Thread Chris Ball

On Mon, 2001-12-17 at 15:46, Jeff 'japhy' Pinyan wrote:
 It certainly puts my C-like code to shame.  It's very nice.

And even more so to my code.  Very well written, Bob.

- ~C.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Win32::Console.

2001-12-13 Thread Chris Ball

On Thu, Dec 13, 2001 at 03:25:06PM -0500, Ryan Guy wrote:
 If anyone knows where I can find some half way decent examples and
 explanations I would be thrilled thanks.

The 'test.pl', 'docs/{intro,reference}.html' and POD files in the
distribution.  Especially the POD, which has documentation and sample
usage for each function.

The [EMAIL PROTECTED] mailing list would be a good place
to follow-up to if you still have questions.

- ~C.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Win32::Console.

2001-12-13 Thread Chris Ball

On Thu, Dec 13, 2001 at 03:55:09PM -0500, Etienne Marcotte wrote:
 Little typo in your message, I've never seen 23 bits OS...:

Hah.  Oh dear.  :-)

It was intentional, honest.  Windows is so sucky that it leaks nine
bits, and can only locate up to 23 bits of addressing space.  It wasn't
a typo at all.

Oops.

- ~C. 
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Opening a URL

2001-12-07 Thread chris . ball

On Fri, 2001-12-07 at 17:19, Juan Manuel Espinoza wrote:
 How can i open a URL in PERL?

With the 'LWP' modules.  In this case, putting the HTML to Google's
front page in $content:

use LWP::Simple;
my $content = get( http://www.google.com/; ) or die $!; 

Hope this helps,

- ~C.
-- 
Chris Ball E-mail: [EMAIL PROTECTED]
Web Programmer Web   : www.fastsearch.com
Fast Web Media Ltd Try   : www.alltheweb.com 
12th Floor Sunlight House, Quay Street, Manchester M3 3JZ, UK.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: thanks for the info on removing control m's

2001-12-06 Thread Chris Ball

On Thu, Dec 06, 2001 at 08:21:30AM -0600, Booher Timothy B 1stLt AFRL/MNAC wrote:
 For example I have 'ABCDEFGH' and I want to get the right three letters:
 Right('abcdefgh',3) = 'fgh'

Use a negative value for the range argument, as described in perldoc -f
substr:

void:chris~ % echo abcdefgh | perl -nle 'print substr($_, -3, 3)'
[ -3 makes us start here ^, 3 makes us travel for three characters. ]

 Left can be done with substring (x,0) I am sure

Yes, indeed: echo abcdefgh | perl -nle 'print substr($_, 0, 3)' 

Hope this helps,

- ~C.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: 'vacation'

2001-11-27 Thread Chris Ball

On Tue, 2001-11-27 at 22:34, Scott R. Godin wrote:
 I've noticed that near 99% of the spam I receive uses this method to 
 mask it from reciept, so typically I filter this with my mailer into a 
 dumping ground, but the sheer amount of spam lately (235 items since Nov 
 5th) has caused me to form a desire to tackle this more forthrightly and 
 aggressively. 

I've been playing with Vipul's Razor recently - http://razor.sf.net/

It's a distributed system for identifying spam; anyone who receives a
spam sends a SHA-1 identifier back to be propagated, and everyone
running a local server can reject based on this hash.  It's probably
overkill for me, but it sounds like you get enough spam to use it -
assuming you have control of the machine your mail comes to. (which I'll
assume, based on your mail address of webmaster@)

Just an idea,

- ~C.
-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: SALT in CRYPT!!

2001-11-22 Thread chris . ball

On Thu, 2001-11-22 at 06:38, nafiseh saberi wrote:
 how does crypt work in adduser function ??
 and...
 how does it use from salt...

I seem to recall our very own Japhy writing a good tutorial on the use
of crypt().  It's at:

http://www.crusoe.net/~jeffp/docs/crypt

Hope this helps,

 - ~C.
-- 
Chris Ball E-mail: [EMAIL PROTECTED] 
Web Programmer Web   : www.fastsearch.com
Fast Web Media Ltd Mobile: +44 (0)7769 903 770
12th Floor Sunlight House, Quay Street, Manchester M3 3JZ, UK.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: recommended perl training in UK?

2001-11-13 Thread Chris Ball

On Tue, 2001-11-13 at 09:36, PURMONEN, Joni wrote:
 This is probably the nices thing one can do at work: my boss asked me to
 find out good quality perl training for intermediate - advanced perl in UK.
 After a lot of searching around none of the places i found really convinced.

Hi, Joni.

The London Perlmonks list may be able to help you with this; their site
is located at http://london.pm.org/, and have discussed topics like this
in the past.  Obviously, your options are to either pay travel expenses
for one of the more notable perl training groups in another country[1]
or find somewhere local to England[2].

Either way, I think it's definitely going to be worth you asking the
london.pm'ers.  Many are going to have personal experience of such
groups, and you might come across someone who runs one.  :-)

Hope this helps,

~C.

[1]: http://www.stonehenge.com/ being the most obvious example.
[2]: Simon Cozens' NetThink comes to mind - http://www.netthink.co.uk/

-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Trying to use the = notation to print the values from this hash

2001-11-13 Thread Chris Ball

On Wed, 2001-11-14 at 03:57, AMORE,JUAN (HP-Roseville,ex1) wrote:
 %Unix= (SHELL = /bin/csh, 
PAGER = more, 
DB = mysql);
 
 print Value: ,= $unix{SHELL}\n; 

The = in the last line is not necessary:

  print Value: , $unix{SHELL}\n;

will DWYM.

As a side point, you might be interested to know that the environmental
variables that your hash represents are already available from within
perl, in the %ENV hash.  For example, 'print SHELL = $ENV{'SHELL'};
will also work as expected.

Hope this helps,

~C.

-- 
$a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
 In the beginning there was nothing, which exploded.  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Off-Topic (200%) - Where are you from?

2001-11-10 Thread Chris Ball

On Sat, Nov 10, 2001 at 08:06:19PM +, Daniel Gardner wrote:
 Manchester, UK

Doubly small world - me too.

As for my use of perl; it started off strictly fun at some point last
year, and moved on as I started to write modules and make scripts
publically available.  Then, back in January, I was hired to work
part-time (alongside studying for a CS degree at UMIST) for a company
that develops search solutions ( http://fast.no/ ), working with Perl
and Oracle.  I'm really enjoying this work, and aside from when my
courses at the University require C, Perl's getting to be my sole
programming language.

/me  :-)

~C.

-- 
Chris Ball.
[EMAIL PROTECTED] || http://printf.net/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]