Harry Putnam wrote:
>
> Maybe unrelated to the comments above since this is `do' I'm posting
> about in this post. But I'm still seeing something here I don't
> understand.
>
> I'll use my reall example code since that is where I notice this
> phenomena.
>
> My function to slurp looks like:
>
On Jan 21, Victor Tsang said:
>$mod = "CGI";
>unless (eval "use $mod")
> {
>warn "unable to install $mod $@\n";
> }
> }
Change your eval() to
eval "use $mod; 1;"
which forces a true value to be returned if 'use' runs successfully.
--
Jeff "japhy" Pinyan [EMAI
from 'perldoc -f use'
use Module ();
That is exactly equivalent to
BEGIN { require Module }
me thinks, what you want is
> #!/usr/bin/perl
> BEG
Hmm... in "simple terms" :-) i don't know if simplicity exists when
telling the difference between our,my,local but here goes:
our
---
* Is Global
* $ABC::DEF::ghi is identical to our $ghi when in package ABC::DEF
my/local
* my is very tightly scoped
* my variab
I have a piece of code which will be used in two different environment,
One of the difference of the 2 system is a special library that is
avaiable to only one of them. Going into the cookbook I found example
12.2 very suitable for my need. So I created the following code to test
the idea
#!/usr
You are actually not explicitly returning anything from the lctime
subroutine, which means that implicitly perl will return the last return
value of what happened in lctime.
Here is what you need to do:
* Change your printf to sprintf (i assume sprintf is what you really
want)
* put a
Can anyone explain in simple terms the difference between the three (my,
our, local). Especially the difference between my and local. Thanks...
CD
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hello all,
I've just recently wiped my drive and did a fresh install of Mandrake
9.0. I installed everything on all 3 of the downloadable iso images and
have noticed that the perldoc command isn't availableI've looked for
rpms and source and can't figure out how to get the docs installed.
I'
Wiggins d'Anconia <[EMAIL PROTECTED]> writes:
> "The file must return true as the last statement to indicate
> successful execution of any initialization code, so its customary to
> end such a file with "1;" unless youre sure itll return true
> otherwise. But its better just to put the "1;",
thanks very much.
- Original Message -
From: "John W. Krahn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 21, 2003 10:11 AM
Subject: Re: help:about file format
> Billy wrote:
> >
> > how to judge a file in dos format or in unix format?
> > thanks for you
Harry Putnam <[EMAIL PROTECTED]> writes:
> Ick... I flew right over that about the `1' in perldoc -f require.
> Always was confused by the term `return'. I guess its pretty basic
> to programmers but to us lifetime heavy construction workers it can
> be a bit mysterious.
>
> Thanks for the guida
Billy wrote:
>
> how to judge a file in dos format or in unix format?
> thanks for your response.
Here is a somewhat simple program that will work with most files. :-)
#!/usr/bin/perl
use warnings;
use strict;
open my $fh, $ARGV[0] or die "Cannot open $ARGV[0]: $!";
my $contents = do { local
Wiggins d'Anconia <[EMAIL PROTECTED]> writes:
> Sorry "customary" (as the perldoc for require states) is a better word
> than "standard". From perldoc -f require:
Ick... I flew right over that about the `1' in perldoc -f require.
Always was confused by the term `return'. I guess its pretty bas
how to judge a file in dos format or in unix format?
thanks for your response.
Wiggins d'Anconia wrote:
Harry Putnam wrote:
pfnc.pm did not return a true value at ./use.pl line 2.
BEGIN failed--compilation aborted at ./use.pl line 2.
Place a line such as:
1;
In the bottom of the library so that it "returns true". This is standard.
http://danconia.org
Sorry
Harry Putnam wrote:
pfnc.pm did not return a true value at ./use.pl line 2.
BEGIN failed--compilation aborted at ./use.pl line 2.
Place a line such as:
1;
In the bottom of the library so that it "returns true". This is standard.
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL
Wiggins d'Anconia <[EMAIL PROTECTED]> writes:
[...]
> 'use' can be as simple or complex as you wish really. The only thing
> slightly more complicated is if @INC doesn't contain where your *.pm
> lives. But that would be a simple case of doing
>
> use lib ('/path/to/libs/');
>
> before your other
On Jan 20, John W. Krahn said:
>Jeff 'Japhy' Pinyan wrote:
>>
>> split(" ", " ab cd ef ") -> "ab", "cd", "ef"
>> split(/\s+/, " ab cd ef ") -> "", "", "ab", "cd", "ef"
> ^^
>Where did that extra string come from? :-)
Oops. Yes, there should
Jeff 'Japhy' Pinyan wrote:
>
> split(" ", " ab cd ef ") -> "ab", "cd", "ef"
> split(/\s+/, " ab cd ef ") -> "", "", "ab", "cd", "ef"
^^
Where did that extra string come from? :-)
John
--
use Perl;
program
fulfillment
--
To unsubscribe,
Rob Dixon wrote:
>
> John W. Krahn wrote:
> >
> > So, you are saying that:
> >
> > split ' ';
> >
> > Is the same as:
> >
> > split m' ';
> >
> > And the same as:
> >
> > split / /;
>
> The second and third are the same. The first one, a
> single space, is a special case. It splits on
On Jan 20, John W. Krahn said:
>Rob Dixon wrote:
>>
>> Sure. I'm saying that
>>
>> split '\.';
>>
>> actually compiles as
>>
>> split m'\.'
>>
>> and is therefore the same. It has to be a valid quotation character
>> though, because anything else won't be recognised out of context.
>
>So,
Or you can use
* The PERL5LIB environment variable
* the "use lib" pragma...
* Compile perl with your library path in it
On Tue, 2003-01-21 at 03:14, [EMAIL PROTECTED] wrote:
> Sure.
> #!/usr/local/bin/perl
>
> BEGIN {
>unshift (@INC, "Your/path/needed");
> }
>
> print "@INC\n";
>
John W. Krahn wrote:
>
> So, you are saying that:
>
> split ' ';
>
> Is the same as:
>
> split m' ';
>
> And the same as:
>
> split / /;
The second and third are the same. The first one, a
single space, is a special case. It splits on whitespace the
same as:
split;
and
split
I suspect we're being baited, but I'll bite. Write this as a normal
Perl program:
#!/usr/bin/perl
$_="7P0>374;";
tr[0->][ LEOR!AUBGNSTY];
print;
It's setting the default variable to that goofball string and then
translating the characters. If you process through the translation, you
get a r
Rob Dixon wrote:
>
> John W. Krahn wrote:
> > Rob Dixon wrote:
> >>
> >> John W. Krahn wrote:
> >>> Scot Needy wrote:
>
> ($wwwname,$cust,$YYMMDDay) = split('\.',$_);
> >>>
> >>> The first argument to split is a regular expression.
> >>>
> >>> my ( $wwwname, $cust, $YYMMDDay
I smell a troll.
Sniff.
/R
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
sure
-l: sets the input and output record separators. here it has the
effect of post-pending a newline at the end of the record.
-e: run the command afterwards.
$_ = "7P0>374;"; set $_ to the string 7P0>374;
tr[0->][ LEOR\!AUBGNSTY]; Apply the transliteration operator to $_.
Transla
Mat Harris wrote:
My email doesn't allow any attachments. Can't you post in the message
body?
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Jan 20, Mat Harris said:
>my boss emailed me this little snippet this morning and I have to confess it
>has me stumped.
>
>Please can someone break down this translation for me?
I hope you (or your boss) have a sense of humor.
>perl -le '$_="7P0>374;";tr[0->][ LEOR!AUBGNSTY];print'
Do you kn
Mat Harris wrote:
> my boss emailed me this little snippet this morning and I have to
> confess it has me stumped.
>
> Please can someone break down this translation for me?
>
> perl -le '$_="7P0>374;";tr[0->][ LEOR!AUBGNSTY];print'
>
> thanks
Perhaps your boss doesn't like you?
--
To unsubsc
Kasi ramanathen wrote:
> $str='
href="Java.Sun.com'">http://srd.yahoo.com/S=2766679:WS1/R=1/K=java/SS=79
559/OCS=79428/H=0/T=1043090181/F=641685fa5455462d4f69450a6fd72ecc/*http:
//java.sun.com/">Java.Sun.com';
> if($str=~/[\w\W]*<(\W)/) {
> print $1;
> print "\n***\n";
> }
>
It's very hard to see
Harry Putnam wrote:
> I know this is a horse that has been ridden hard before, but not so
> easy to find the results.
>
> How does one slurp a function or series of functions in perl?
> Similar to the way its done in shells':
>. somefunction
>
> I know about the:
> use (some.pm file);
>
Eri Mendez wrote:
> hi all,
>
> another newbie here. im having problem how to print to stdout the
> string[s] entered by user and appending a subscript integer after that
> string. this is my modification to exercise 1 chapter 3 of Llama book:
>
> #!/usr/bin/perl -w
> use strict;
>
> # filename:
Mat,
Why did your message have an attachment named "file.bin"? Yahoo's
virus scan said it was clean, but it still makes me nervous.
RobR
__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
To un
my boss emailed me this little snippet this morning and I have to confess it
has me stumped.
Please can someone break down this translation for me?
perl -le '$_="7P0>374;";tr[0->][ LEOR!AUBGNSTY];print'
thanks
--
Mat Harris OpenGPG Public Key ID: C37D57D9
[EMAIL PROTECTED
Eri Mendez wrote:
>
> hi all,
Hello,
> another newbie here. im having problem how to print to stdout the
> string[s] entered by user and appending a subscript integer after that
> string. this is my modification to exercise 1 chapter 3 of Llama book:
>
> #!/usr/bin/perl -w
> use strict;
>
> #
$str='http://srd.yahoo.com/S=2766679:WS1/R=1/K=java/SS=79559/OCS=79428/H=0/T=1043090181/F=641685fa5455462d4f69450a6fd72ecc/*http://java.sun.com/";>Java.Sun.com';
if($str=~/[\w\W]*<(\W)/)
{
print $1;
print "\n***\n";
}
the output of the programe is
/
but i want the output as (extracting f
Harry Putnam wrote:
I know this is a horse that has been ridden hard before, but not so
easy to find the results.
How does one slurp a function or series of functions in perl?
Similar to the way its done in shells':
. somefunction
I know about the:
use (some.pm file);
syntax, of course,
I know this is a horse that has been ridden hard before, but not so
easy to find the results.
How does one slurp a function or series of functions in perl?
Similar to the way its done in shells':
. somefunction
I know about the:
use (some.pm file);
syntax, of course, but it seems to entail
"print "\t\[", $_, "\] $_\n";"
Hi Eri,
I would suggest dispensing with the comma operators. They can have some rather
unexpected effects in this context. Remember--variables within full quotes are
interpolated before the string is taken. So you could write the above as:
print "\t\[$_
Mkrous wrote:
>
> The problem comes when the authorised user wants to
> delete a file. When I lock exlusively the file to be
> deleted I can not perform an unlink, and unlink does
> not
> work with a filehandle.In the delete module I use the
> following code:
>
> my $
Eri Mendez wrote:
> hi all,
>
> another newbie here. im having problem how to print to stdout the
> string[s] entered by user and appending a subscript integer after that
> string. this is my modification to exercise 1 chapter 3 of Llama book:
>
> #!/usr/bin/perl -w
> use strict;
>
> # filename:
Hi
i am trying to install a perl module's rpm but see
following is happening , i also tried looking for
these modules but not able to find can some one point
me
[root@ctsweb prashant]# !rpm
rpm -i perl-OLE-Storage_Lite-0.10-8.i386.rpm
error: failed dependencies:
perl(:WITH_ITHREADS)
hi all,
another newbie here. im having problem how to print to stdout the
string[s] entered by user and appending a subscript integer after that
string. this is my modification to exercise 1 chapter 3 of Llama book:
#!/usr/bin/perl -w
use strict;
# filename: reverse_string.pl
# editor: # VIM - V
> From: Rob Dixon <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: compare multiple lines
> Date: 20 Jan 2003 11:55:32 +
>
> Mertens Bram wrote:
[snip]
> > No, folders always have the NAME, CREATED and ORDER fields. URL's
> > always have the NAME, URL, CREATED, VISITED and ORDER fie
Paul Kraus wrote:
> I read that you can find out what format letters your Perl
> distribution supports by looking at the man page for perlfunc. Now I
> am running windows xp so I tried perldoc perlfunc but couldn't find
> anything on format letters. Any other suggestions as to where I can
> find th
I read that you can find out what format letters your Perl distribution
supports by looking at the man page for perlfunc. Now I am running
windows xp so I tried perldoc perlfunc but couldn't find anything on
format letters. Any other suggestions as to where I can find this out?
--
To unsubscribe
> -Original Message-
> From: Scot Needy [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 20, 2003 4:58 PM
> To: NYIMI Jose (BMB); Beginners Perl
> Subject: RE: Nested hash creation help !
>
>
>
> Thanks Jose!
>
> I have the hash created and now can see the values
> using Data::Dumpe
Nils-Anders Persson wrote:
> Hello PERL-gurus,
>
> I wonder if there is a way to add a new path to the @INC-array
> permanently under UNIX and, if so, how to do it.
Put your additional directory into the PERL5LIB environment variable.
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
Fo
Sure.
#!/usr/local/bin/perl
BEGIN {
unshift (@INC, "Your/path/needed");
}
print "@INC\n";
good luck
YG
Original Message:
-
From: Nils-Anders Persson [EMAIL PROTECTED]
Date: Mon, 20 Jan 2003 16:05:52 +0100
To: [EMAIL PROTECTED]
Subject: Adding new path to @INC
Hello PERL-gu
Play around with *FILEHANDLE. For example:
open FILEHANDLE, ">blah.txt";
&closeFile( *FILEHANDLE );
sub closeFile {
my $fh = shift;
print $fh "I closed you.\n";
close $fh;
}
Mkrous wrote:
Cheers Joseph,
thanks for your reply.
Still it does not work,
$FileHandle is set to the 'FILE
Hello PERL-gurus,
I wonder if there is a way to add a new path to the @INC-array permanently
under UNIX and, if so, how to do it.
Regards,
Nils-Anders
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Cheers Joseph,
thanks for your reply.
Still it does not work,
$FileHandle is set to the 'FILEHANDLE' string
and unlink can't work because no file with filename
FILEHANDLE exists.
Any other ideas?
Macis
--- "R. Joseph Newton" <[EMAIL PROTECTED]> wrote:
>I will try something like:
>
> my $FileHand
"...unlink(FILEHANDLE);# Bareword FILEHANDLE" not allowed
#while "strict subs" in use."
Hi Macis,
I have a very similar problem that cropped up when I started using strict on a file
that had formerly worked. I'm headed for the day job now, but when I get home I will
try something like:
my $Fi
John W. Krahn wrote:
> Rob Dixon wrote:
>>
>> John W. Krahn wrote:
>>> Scot Needy wrote:
($wwwname,$cust,$YYMMDDay) = split('\.',$_);
>>>
>>> The first argument to split is a regular expression.
>>>
>>> my ( $wwwname, $cust, $YYMMDDay ) = split /\./;
>>
>> But, as it has an im
John W. Krahn wrote:
> Rob Dixon wrote:
>>
>> John W. Krahn wrote:
>>>
>>> You should _always_ verify that the file opened successfully.
>>
>> Sure, but that's not what the question was about. You should always
>> add 'use strict' and 'use warnings' too, but I didn't put that in
>> either.
>>
>>> m
Rob Dixon wrote:
>
> John W. Krahn wrote:
> > Scot Needy wrote:
> >>
> >> ($wwwname,$cust,$YYMMDDay) = split('\.',$_);
> >
> > The first argument to split is a regular expression.
> >
> > my ( $wwwname, $cust, $YYMMDDay ) = split /\./;
>
> But, as it has an implied 'm',
I don't know
Rob Dixon wrote:
>
> John W. Krahn wrote:
> > Rob Dixon wrote:
> >>
> >> open FILE, "< file.txt";
> >
> > You should _always_ verify that the file opened successfully.
>
> Sure, but that's not what the question was about. You should always add
> 'use strict' and 'use warnings' too, but I
Scot Needy wrote:
> Hi;
>
> Trying to crate a nested hash from variables parsed out of log files
> but as I am a "Beginner Perl' coder it is failing terribly. The basic
> question is given you have 5 variables how would you make a nested
> hash.
>
> Thanks !
> Scot
>
> I hope this is enough code t
Nicole Seitz wrote:
> Hi there!
>
> Today just a short question: Is there an Immediate If-Function in
> Perl?
Same as C:
$noun = ( $count == 1 ? 'rabbit' : 'rabbits' );
(parentheses not strictly necessary).
BTW, don't go around calling it an 'immediate if' to Perl people,
it's a 'conditiona
John W. Krahn wrote:
> Scot Needy wrote:
>>
>> Hi;
>
> Hello,
>
>> Trying to crate a nested hash from variables parsed out of log
>> files but
>> as I am a "Beginner Perl' coder it is failing terribly. The basic
>> question
>> is given you have 5 variables how would you make a nested hash.
>>
>> I
Mertens Bram wrote:
> On Sun, 2003-01-19 at 23:31, Wagner, David --- Senior Programmer
> Analyst
> --- WGO wrote:
>> Are there other fields which you do not have in the defining of
>> either Folders and URL's?
>
> No, folders always have the NAME, CREATED and ORDER fields. URL's
> always have the
Hi all,
I want to play an audio file that resides in a remote machine .How
can I do this using perl.
thanks in advance
shine
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
David --- Senior Programmer Analyst --- Wgo Wagner wrote:
>
> It appears that it should not be too hard to do this. I would
> rather see a file with a few more entries for Folders and URL's.
>
The syntax is simply a series of #FOLDER blocks, each followed by zero
or more #URL blocks. Blocks of ea
Afterwards, to see how your nested hash looks like,
try this:
use Data::Dumper;
print Dumper(\%time);
José.
> -Original Message-
> From: Scot Needy [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 20, 2003 6:50 AM
> To: Beginners Perl
> Subject: Nested hash creation help !
>
>
> Hi
I would be writing this:
#!/usr/bin/perl -w
use strict;
foreach my $logfile (@wwwlogs) {
my %time=();
my ($wwwname,$cust,$YYMMDDay) = split(/\./,$logfile);
open (LOG, $logfile) || die "Can't open $logfile : $! \n";
while () {
chomp;
#
Hi all,
I'd like to pose the following question:
I am new to perl and I try to make a website using
apache and modperl,
in which authorised users upload files for other users
to download.
For upload, I copy the files in a folder and I put
the filePath in a mySQL db. I am also using a fileID
to re
Scot Needy wrote:
>
> Hi;
Hello,
> Trying to crate a nested hash from variables parsed out of log files but
> as I am a "Beginner Perl' coder it is failing terribly. The basic question
> is given you have 5 variables how would you make a nested hash.
>
> I hope this is enough code to example m
Hi there!
Today just a short question: Is there an Immediate If-Function in Perl?
Thanx for your help in advance!
Nicole
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Sun, 2003-01-19 at 23:31, Wagner, David --- Senior Programmer Analyst
--- WGO wrote:
> Mertens Bram wrote:
[snip]
> > I would like to be able to remove all duplicate entries without
> > destroying the structure of the file.
[snip]
> It appears that it should not be too hard to do this. I
Having a quick look, I may say your ploblem can be solved with hash references.
Something like:
my %hash_level1=();
my %hash_level2=();
$hash_level1{'tag'}=\%hash_level2;
To retrieve a value form hash_level2:
my $hash_p= $hash_level1{'tag'};
Return ${$hash_p}{'tag_from_level2'};
Hope it helps,
Hi;
Trying to crate a nested hash from variables parsed out of log files but
as I am a "Beginner Perl' coder it is failing terribly. The basic question
is given you have 5 variables how would you make a nested hash.
Thanks !
Scot
I hope this is enough code to example my problem.
--
72 matches
Mail list logo