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 l
rypt::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&qu
quot;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]
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:
ope
ry.
- 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."
| -- ga
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]
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 t
ssion 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.
--
Ch
ompiled 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 | chri
ur code with:
'$b = 1; $b++;' or '$b = 1; $b = $b + 1', you'll get more expected
behaviour. :)
- 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!
a can be plotted to many different type of graph -
GD::Graph::{lines,bars} etc.)
- 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
e that; that's what your '1' is - a success code.
Your problems can be easily solved, though. sprintf() returns the
string that printf() would have printed. You can just replace the
printf() call with one to sprintf(), and all should work fine. :)
Hope this helps,
- Chris.
pt 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 re
nd 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@$
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]).","'
s 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]).","'
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
r 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
n 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=&qu
e 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]
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=
; 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]
>>>>> "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 B
--
)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]
hing 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]
ortcut to having to bother issuing an open() call and have the
unbearable hassle of setting up a file handle.
We should have a Lazy Perl Programming FAQ, as a list of things that you
can^Wshouldn't do to speed up a perl script. ;-)
- Chris.
--
$a="printf.net"; Chris Ball | chri
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]
rrays 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";
;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
>>>>> "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. Look
ave 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]
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@vo
; 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
Simple with regexps to transform sub definitions.
- 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]
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]
on).
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]
are stored in a way that prevents you
from imposing an order on key-value pairs. Instead, you
have to sort a list of the keys or values:
@keys = sort keys %hash;# sorted by key
--
$a="printf.net"; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As
n 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.
27;use locale;' to the top of your script. It depends on your system's
locale configuration being sane, but it should solve your problem if
this is so.
Hope this helps,
- Chris.
--
$a="printf.net"; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
"In the beg
ser 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]
m('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 f
ilename))[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
egex 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 explode
t all data from H1 BGCOLOR="FF">I want all if this data extracted from
Daniel> heading 1 (h1)
while ($stream->get_tag("h1")) { $data = get_trimmed_text("/h1"); }
(Also see perldoc HTML::TokeParser, once it's installed.)
- Chris.
--
$a="pr
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 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
he 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.
oking 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@$
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-m
problem, even if they don't; fun to solve, even if my method was
(*cough*) a little long.
Thanks,
- ~C.
--
$a="printf.net"; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
"In the beginning there was nothing, which exploded."
--
To unsubscribe,
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
nk 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;
- ~C.
--
$a=&qu
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
#x27;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]
D, 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
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
ubstr:
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,
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,
d, and I'm in need of sleep. If anyone more
alert than myself can see anything stupid, please let me know. :-)
If you need a hand with initialising the object, I've got a tutorial to
TokeParser (though also manipulating XML:RSS) up on the web at:
http://www.perl.com/pub/a/2001/11/15/
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]
ail I'd recommend
these.
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]
gt; 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, '
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 unsubscri
;get_trimmed_text("br");
You'll have some small tidying up to do on both, but it's a /much/ more
readable (and maintainable) way of parsing the HTML.
Hope this helps, (from one Manchester perl bod to another ;-)
~C.
--
$a="printf.net"; Chris Ball | chris@void.$a |
to be my sole
programming language.
:-)
~C.
--
Chris Ball.
[EMAIL PROTECTED] || http://printf.net/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
65 matches
Mail list logo