Hi All,
Please go through the following scenario:
A perl script has been invoked from shell A. Within the perl script, I
open a new terminal (say B) allowing the user set a particular variable
to his choice. The user sets the variable in this terminal and will exit
the terminal so that the perl
On Tue, 23 Jul 2002, dan wrote:
> ok.. that worked, now how about if i wanted it to go the other way.. from
> most to least?
foreach my $MyId (sort {$usernum{$a} <=> $usernum{$b}} keys (%usernum)) {
print "$MyId\n";
}
This will print
server.two.com
server.four.com
server.three.com
server.one
On Tue, 23 Jul 2002, Manya wrote:
> Hi
> I am new to Perl.
> My prog. goes like this
>
> use Net::SMTP
>
>
> ---
> it gives the message can not locate Net/SMTP.pm in
Have you installed Net::SMTP, it comes as a part of libnet package.
If you have installed it check that the install d
Hi
I am new to Perl.
My prog. goes like this
use Net::SMTP
---
it gives the message can not locate Net/SMTP.pm in
What is wrong?
Please help
Manya
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Databas
ok.. that worked, now how about if i wanted it to go the other way.. from
most to least?
dan
"David Wagner" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Here is one shot:
>
>
> %usernum = ( "server.one.com", "15",
> "server.two.com", "5",
> "server.three.co
What I am about to raise, I do so more out of wanting someone to educate me
than disagreeing for the sake of. The *that syntax shown below is unfamiliar
to me outside the context of referencing a filehandle in a subroutine params
list, where it is optional (ie., &some_sub(*STDIN)). *that remi
I have two variables (@array1 and @array2). @array1 will be
initialized with a list of values. Is it possible to declare @array2
in such a way that it will reference @array1?
I am trying to avoid looping through the elements and copying over.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For ad
the command 'sort' allow you to put in your own routine to do sorting.
%usernum = ("server.one.com" => "15",
"server.two.com" => "5",
"server.three.com" => "14",
"server.four.com" => "9");
@arr = sort {$usernum{$a} <=> $usernum{$b}} (keys %usernum);
print j
> I've tried with /g alone and also with /gs, /gm, and /gms. As long as /s is
> one of the modifiers I do match one instance, but in no case do I match
> multiple instances. Weird.
Give this a try...
while () {
if(m/(p1).*?(p2)/gs) {
print "match! found $1 and $2.\n";
}
}
The problem is
David --
...and then David Newman said...
%
% > Yes, but your *. should be .* to work. When you have
%
% Sorry, typo. It is .* in the code!
Ah. Well, then, there's more...
%
...
% > % Again, my goal is to match each instance of /(p1)*anything*(p2)/.
% >
% > I should think that
% >
% > u
Are you searching for M or using the single character when in
vim? Single character being followed by this should
at the / or in a substituition work.
If that makes no sense I can try and explain it differently.
This method also works when inputting the string into the Perl sub,
however if
Dan wrote:
>
> I have a small query regarding how to sort hash entries in numerical order.
>
> %usernum { "server.one.com" "15",
> "server.two.com" "5",
> "server.three.com" "14",
> "server.four.com" "9" }
>
> How can i get perl to ret
Here is one shot:
%usernum = ( "server.one.com", "15",
"server.two.com", "5",
"server.three.com", "14",
"server.four.com", "9" );
foreach my $MyId (sort {$a->[1] <=>$b->[1]} map{[$_,$usernum{$_}]} keys
%usernum) {
printf "%-s\n", $My
Here is what I am doing
use A;
my $this = {};
bless $this;
my $result = $this->A::sub1 (my $args);
Package A;
sub1 {
my $this = shift
my ($data) = @_;
my $result = $this->sub2($data); $this->sub2($data) does not load
return "$result";
}
sub2 {
...
}
I think I can understand why sub2 canno
I would check to see if this copy is legal before sending out the link
again. ~Some~ Russian sites put pirated copies of books online.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
(sorry if this message comes twice.. didn't appear to have sent the first
time)
I have a small query regarding how to sort hash entries in numerical order.
%usernum { "server.one.com" "15",
"server.two.com" "5",
"server.three.com" "14",
I have a small query regarding how to sort hash entries in numerical order.
%usernum { "server.one.com" "15",
"server.two.com" "5",
"server.three.com" "14",
"server.four.com" "9" }
How can i get perl to return these 4 server names in th
There's perl in 21 days... found it by using google.
http://194.106.118.30/ftp/Docs/Internet/Perl%205%20in%2021%20days/
Kaavla wrote:
>
> Any good perl on-line books that are available for free..
> My budget for learning perl is small.. So can't afford to buy the learning
> Perl books..
> Any
> Yes, but your *. should be .* to work. When you have
Sorry, typo. It is .* in the code!
> % If I do (for example) "p1 p2 p1 p2\n\np1 p2", shouldn't the
> while loop match
> % on 3 instances? If not, what should I use to match each instance?
>
> Now that it's all one big line, you need /g to
Hi Timothy
--- Timothy Johnson <[EMAIL PROTECTED]> escribió:
>
> Para clarificacion, estas buscando la programa que
> interpreta los scripts
> creado en Perl, no? Si estas usando Windows, lo
> puede encontrar aqui:
> http://www.activestate.com. Se llama ActivePerl.
> Si estas usando UNIX, se
"John W. Krahn" wrote:
>
> Jenda Krynicky wrote:
> >
> > From: Konrad Foerstner <[EMAIL PROTECTED]>
> >
> > > I have a strange error in my script. It should
> > > paint a column of lines next to each other in
> > > colors which are determinated by a given sequence
> > > of letters. It works...but
Desmond --
...and then Desmond Lee said...
%
...
% A sample from the file looks like this:
%
% while ( $row = $db->sql_fetchrow($result) );^M
% $db->sql_freeresult($result);^M^M $total_threads =
% count($threadrow);^M }^M else^M {^M
% message_die(G
David --
...and then David Newman said...
%
% many thanks...
Here's hoping I can help, too :-)
%
% > Set $/ to undef instead.
Good.
% >
...
% > > if (m/(p1)*.(p2)/ms) {
...
% > When $/ is "", it's like the regex /\n{2,}/.
%
% wouldn't this have worked before, since the pattern was
Hi Tanton
Thanks for the reply. I tried what you suggested, but i get no luck. So far
i'm about 1/4 of the way through the file just doing it manually. Do you
ahve any other suggestion?
A sample from the file looks like this:
while ( $row = $db->sql_fetchrow($result) );^M
$db->sq
many thanks...
>
> >$/ = '';
>
> Set $/ to undef instead.
>
> >while() {
> > if (m/(p1)*.(p2)/ms) {
> > print "match! I found $1 and $2\n.";
> > }
> >}
this does work, but...
>
> When $/ is "", it's like the regex /\n{2,}/.
wouldn't this have worked before, since t
David Newman wrote:
>
> Consider a file containing this pattern:
>
> p1
> p2
>
> I can match for p1 and p2 like this:
>
> $/ = '';
perldoc perlvar
You are setting $/ to paragraph mode which is why the second example
doesn't work.
> while() {
> if (m/(p1)*.(p2)/ms) {
Jenda Krynicky wrote:
>
> From: Konrad Foerstner <[EMAIL PROTECTED]>
>
> > I have a strange error in my script. It should
> > paint a column of lines next to each other in
> > colors which are determinated by a given sequence
> > of letters. It works...but only to the position
> > of 251. After
On Jul 22, David Newman said:
>$/ = '';
Set $/ to undef instead.
>while() {
> if (m/(p1)*.(p2)/ms) {
> print "match! I found $1 and $2\n.";
> }
>}
When $/ is "", it's like the regex /\n{2,}/. If it's undef, then
slurps the entire file at once.
--
Jeff "japhy" Piny
Consider a file containing this pattern:
p1
p2
I can match for p1 and p2 like this:
$/ = '';
while() {
if (m/(p1)*.(p2)/ms) {
print "match! I found $1 and $2\n.";
}
}
However, the match fails if I change the pattern to:
p1
p2
What I would like to do is mat
That ^M is the \r that is used by DOS based systems for EOL. Basically, DOS
uses \r\n for EOL and Unix only uses \n. So, you have to eliminate all of
the \r.
If you have dos2unix on your system you can use that program otherwise do:
perl -pi.bak -e 's/\r\n/\n/g' moby_threads_install.txt
-
Hi guys
I'm trying to read a file, but it's just one massive line. I think that the
^M is suppose to be an indication that that's wehre teh newline is suppose
to be. I've tried to replace ^M with a newline by executing something that i
found on the web:
perl -pi.bak -e 's/\^M/\n/g' moby_thre
Hi guys
I'm trying to read a file, but it's just one massive line. I think that the
^M is suppose to be an indication that that's wehre teh newline is suppose
to be. I've tried to replace ^M with a newline by executing something that i
found on the web:
perl -pi.bak -e 's/\^M/\n/g' moby_thre
On Monday, July 22, 2002, at 10:21 , kent ho wrote:
> Hi All,
> Just a generic "sed" question, please help.
>
> How do I pass a variable to this sed command:
>
> MONTH="Mar"
> sed '/$MONTH/,$d' foo > foo.new
#!/bin/sh
d="231"
MONTH="Mar"
sed '/'$MONTH'/,$d' foo
I have a small array that looks like this:
@array = qw(rtf1_deff fonttbl s33_up7)
I generate this file from parsing an rtf file. I have to process each
element in the array. I have to separte the letters from the numbers. So
the first element would break down to "rtf" and "1". Based on the first
From: Konrad Foerstner <[EMAIL PROTECTED]>
> I cansee here no advandtage. But I left out some
> details: I need to handle with capital and small letters
> and the different letters will get differenz colors (no in groups). I
> haven't tried your solution, because I can't find the solution for the
> -Original Message-
> From: Konrad Foerstner [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 22, 2002 2:19 PM
> To: [EMAIL PROTECTED]
> Subject: Position 251 ???
>
>
> Hi,
>
> I have a strange error in my script. It should
> paint a column of lines next to each other in
> colors which
I cansee here no advandtage. But I left out some
details: I need to handle with capital and small letters
and the different letters will get differenz colors (no in groups).
I haven't tried your solution, because I can't find the
solution for the my problem...perhaps you could explane it to me?
K
Weekly posting statistics for perl.beginners - week 29 of 2002.
>From Monday 2002-07-15 to Sunday 2002-07-21 there were
513 articles posted (24414 lines) by 133 authors, giving an average
3.86 articles per author, and an average article length of 48 lpa.
The average number of articles per day w
From: Konrad Foerstner <[EMAIL PROTECTED]>
> I have a strange error in my script. It should
> paint a column of lines next to each other in
> colors which are determinated by a given sequence
> of letters. It works...but only to the position
> of 251. After this point all lines have the color
>
Kent --
...and then kent ho said...
%
% Hi All,
% Just a generic "sed" question, please help.
Don't you think, then, that you'd be more likely to get a useful answer
on a sed list?(!!?)
%
% How do I pass a variable to this sed command:
%
% MONTH="Mar"
% sed '/$MONTH/,$d' foo > foo.new
Use
Hi,
I have a strange error in my script. It should
paint a column of lines next to each other in
colors which are determinated by a given sequence
of letters. It works...but only to the position
of 251. After this point all lines have the color
of the line at position 251...even when I use
a dif
Hi All,
Just a generic "sed" question, please help.
How do I pass a variable to this sed command:
MONTH="Mar"
sed '/$MONTH/,$d' foo > foo.new
Thanks,
Kent
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Javeed Sar wrote at Mon, 22 Jul 2002 12:07:23 +0200:
> Hi All,
>
>
> I am using (given below) net use in batch files, how to do the same in
>perl That is:
>
> net use u: /del
> do net use u:
The simplest solution is to call it like at the command line
via backticks:
`net use u: /d
I think any of the inelegancies or benchmarks of either language are
minor in comparison to the benefit of working in a language you are
familiar with. That having been said, I would stay away from perl (or
php) cgi, and stick with an embedded solution (mod_php for php, one of
the embedded pe
Folks,
I have come to a road block of sorts, I am currently working on a
web front-end to a Oracle 8i DB. We are looking to allow users to enter
their own quires generated via check boxes for tables and a simple step by
step process to aid in the sql creation.
I was wondering, wh
I've used the following two books and they were great for learning.
Beginning Perl by Simon Cozens. Wrox Publishing. ISBN: 1861003145
MySQL by Paul DuBois. New Riders Publishing. ISBN: 0735709211
I created a web frontend to a database and a couple other web apps with the
two above books and help
Para clarificacion, estas buscando la programa que interpreta los scripts
creado en Perl, no? Si estas usando Windows, lo puede encontrar aqui:
http://www.activestate.com. Se llama ActivePerl. Si estas usando UNIX, se
que lo puedes buscar en http://www.perl.org o http://www.cpan.org. Ahi
tamb
Hi, i'm new here and in perl... i want to do a
iterpreter for the university (like c) i found one for
basic and prolog, but i don't understand, can anyone
help me, with a little example or a web where i can
found information... (there isn't money for books!!!).
Thank you
PD: sorry me english, in
Hi there, I have two databases, One and Many. The One db has all the header
information, and the Many db has all the detail line information associated
with One db. I want to combine these two databases into one that has only
one record/line item that has columns for the detail line item from the
On Monday, July 22, 2002, at 08:11 , Bob H wrote:
> I have a script that is *supposed* to search a file and make certain
> words that I have in an array uppercase. My brain is not grokking it.
>
> Q1: What is wrong with my script (below)?
what sorts of error messages did you get?
> === SCRIPT
See inline comments
> -Original Message-
> From: Bob H [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 22, 2002 11:12 AM
> To: [EMAIL PROTECTED]
> Subject: UPPERCASE and DOING MULTIPLE THINGS
>
>
> I have a script that is *supposed* to search a file and make certain
> words that I have
On Jul 22, Bob H said:
>I have a script that is *supposed* to search a file and make certain
>words that I have in an array uppercase. My brain is not grokking it.
You should not use tr/// to make strings uppercase. Perl provides the
uc() function for that.
>Q1: What is wrong with my script (b
I have a script that is *supposed* to search a file and make certain
words that I have in an array uppercase. My brain is not grokking it.
Q1: What is wrong with my script (below)?
Q2: Can I update a file in place?
Q3: How do I run multiple things against one file in one script?
=== SCRIPT ===
You could just execute the same commands you already are (with backticks
round them to make the shell handle them)
`net use u: /del`
`do net use u:`
There may be some Win32:: modules on CPAN for mapping drives to do it a
different way. TMTOWTDI.
Nigel
>>> Javeed SAR <[EMAIL PROTECTED]> 07/22/
Daniel David a Ýcrit :
> Hi ,
>
> how do you open a file - starting at a particular line?
> eg to start reading the file from line 500 ?
>
> thanks for your help.
>
> _
> MSN Photos is the easiest way to share and print your photos:
> -Original Message-
> From: Scott Taylor [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 5:30 PM
> To: [EMAIL PROTECTED]
> Subject: RE: populating hash from DBI
>
>
> At 02:20 PM 18/07/2002, Bob Showalter wrote:
>
> >Each pass through the loop overwrites %numlegs, so it will
The reason this doesnt do what you expect it to do is because you are
calling your function, which is then executing your SQL command and
returning the first recordset.
You are doing this over and over again - instead you should have some sort
of loop in your function that loops through ALL the
Hello Charlie,
[snip]
> ===
>
> This is my function attempting to do the same thing(?).
>
> sub Comment() {
>
> my( $sth );
>
> $sth = $dbh->prepare("SELECT comment from dbtable
> where com
I'm trying to get a grip on functions.
I want to connect to a database, execute a SELECT statement, and print
each line where the criteria is met.
This does what I want.
my $comment;
while ( $comment = $sth->fetchrow_array) {
print "$comment\n";
}
===
Hi All,
I am using (given below) net use in batch files, how to do the same in
perl
That is:
net use u: /del
do net use u:
Regards
javeed
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi folks,
Thanks for all the replies, I've now finished the script.
Nathan.
-Original Message-
From: Nathan Mattick
Sent: Friday, July 19, 2002 2:38 PM
To: [EMAIL PROTECTED]
Subject: Q: Basic file operations...
Could someone please help, how do I:
[1] test whether a file exists bef
61 matches
Mail list logo