Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

perl-beginner · Perl Beginners Mailing List

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 3761
  • Category: Perl
  • Founded: Aug 2, 1998
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 13582 - 13611 of 27470   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#13582 From: Greg Matheson <lang@...>
Date: Sat Feb 1, 2003 10:56 am
Subject: Re: [PBML] perl without a web server
lang@...
Send Email Send Email
 
On Thu, 30 Jan 2003, Hud clark wrote:

> If you have a local machine with no web server, but it has perl, and you
> want to do perl cgi?

Use lynx. But it needs to be compiled with the execute cgi
option.

--
Greg Matheson                Those who can do.
Dr Bean's Penpal Pool        Those who can't teach.
Address: palpool             --G B Shaw
Domain:  @cn91.chinmin.edu.tw

#13583 From: Ben Maynard <liliafan@...>
Date: Sat Feb 1, 2003 1:01 pm
Subject: Re: [PBML] perl without a web server
liliafan
Send Email Send Email
 
lynx has a cgi option?  Learn a new thing everyday I
have been using it for about 5 years and never took
the time to notice that.  What are flags to do so?

Thanks

Ben

  --- Greg Matheson <lang@...> wrote: >
On Thu, 30 Jan 2003, Hud clark wrote:
>
> > If you have a local machine with no web server,
> but it has perl, and you
> > want to do perl cgi?
>
> Use lynx. But it needs to be compiled with the
> execute cgi
> option.
>
> --
> Greg Matheson                Those who can do.
> Dr Bean's Penpal Pool        Those who can't teach.
> Address: palpool             --G B Shaw
> Domain:  @cn91.chinmin.edu.tw
>
> Unsubscribing info is here:
> http://help.yahoo.com/help/us/groups/groups-32.html
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

#13584 From: Florence Chukwudebe <illnoizeproductions@...>
Date: Sat Feb 1, 2003 5:47 pm
Subject: Re: [PBML] Digest Number 1102
illnoizeprod...
Send Email Send Email
 
anyone know how to use the cgi script in paypal to set up a gate way for people
to get a user name and password after payment?
  perl-beginner@yahoogroups.com wrote:Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html
------------------------------------------------------------------------

There are 5 messages in this issue.

Topics in this digest:

1. Re: A little help please
From: "John Doe "
2. PL/SQL Call
From: "Steve "
3. Re: fetch mails content from yahoo mails
From: "Octavian Rasnita"
4. Re: Perl error
From: "Octavian Rasnita"
5. Re: Perl error
From: "Octavian Rasnita"


________________________________________________________________________
________________________________________________________________________

Message: 1
Date: Fri, 31 Jan 2003 12:46:49 -0000
From: "John Doe "
Subject: Re: A little help please

--- In perl-beginner@yahoogroups.com, "Greg "
wrote:
> --- In perl-beginner@yahoogroups.com, "John Doe "
> wrote:
> > I have made a search engine to list scripts on the internet now all
> I
> > need is that some webmasters submit their scripts to it.
> >
> > I thought that some of you guys would like to list some of your
> > scripts.
> -------------------------------------------------------------
> ...and maybe you'd like to give us your search engine script?
> -------------------------------------------------------------
>
> _G

Do you want to make one like this yourself???

I'll set one up for you on my server if you want?



________________________________________________________________________
________________________________________________________________________

Message: 2
Date: Fri, 31 Jan 2003 14:35:01 -0000
From: "Steve "
Subject: PL/SQL Call

Hello,

Has anyone used the following module with any success:

DBIx::Procedure::Oracle

This module allows the calling of Oracle PL/SQL functions and
procedures without writing SQL statements to reference them.

What I am trying to do is call PL/SQL functions from a Perl script,
but I haven't had any success yet. If anyone has, or knows a better
way of doing this, please let me know.

Thanks,
Steve



________________________________________________________________________
________________________________________________________________________

Message: 3
Date: Fri, 31 Jan 2003 09:38:24 +0200
From: "Octavian Rasnita"
Subject: Re: fetch mails content from yahoo mails

And for Windows there is a program with a graphical interface named
Yahoopops which is free.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: orasnita@...

----- Original Message -----
From: "Richard Carver"
To:

Sent: Thursday, January 30, 2003 11:38 PM
Subject: Re: [PBML] fetch mails content from yahoo mails


Yep! It can and has been done!

Checkout the FetchYahoo Perl program at

http://fetchyahoo.twizzler.org/

There's also some links there to a few other Perl and
java programs that do similar.

I've used FetchYahoo and it works just fine for me.

Regards,
Rich


> Hi,
> I was wondering if we can write a script cgi/php/javascript... to
> fetch the mail content of all the mails in yahoo/hotmail by providing
> the user name and password to the script itself. This I want as it
> takes too much of time on my browser to see the contents of mailing
> mails in my yahoo account. so I am looking for some alternative as to
> run a script such that it retrieves all the mails from my yahoo
> account at one stretch into a text file. I am not sure if at all this
> is possible. Please educate me. And if it is possible can some body
> please let me know the sample code for it...
>
> Thanks
>
> Mike
>
>
> Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>

Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/






________________________________________________________________________
________________________________________________________________________

Message: 4
Date: Fri, 31 Jan 2003 09:41:08 +0200
From: "Octavian Rasnita"
Subject: Re: Perl error

I've tried this way first, but it gave me the same error.

If I use just that code for forkin in a separate program, it works, but in
the program I want to put it, it doesn't work.

Thanks.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: orasnita@...

----- Original Message -----
From: "Ben Maynard"

To:

Sent: Thursday, January 30, 2003 6:56 PM
Subject: Re: [PBML] Perl error


Someone is bound to correct me on this but as I recall
the fork function has some major issues on win32
platforms ie. it doesn't work.

If I am wrong on this or it has been corrected in more
recent versions I apologise I haven't used win32 perl
for several years.

Regardless I don't think that code would work for a
fork anyway try:

# Untested

if($pid = fork)
{
# do parent stuff
}
elsif (defined($pid))
{
exec 'perl m.pl';
}
else
{
print "Cannot fork: $!";
}

HTH

Ben

--- Octavian Rasnita wrote: > Hi
all,
>
> I've tried to use a fork function in a CGI program
> to run another perl
> script, but it gives me a bad error:
>
> perl.exe - Application Error The instruction at
> "0x28068533" referenced
> memory at "0x00000004". The memory could not be
> "read". Click on OK to
> terminate the program Click on CANCEL to debug the
> program OK Cancel
>
> Here is the part of the script that forks (without
> it, the program works
> fine):
>
> $| = 1;
> $SIG{CHLD} = "IGNORE";
> fork;
> close STDOUT;close STDIN;close STDERR;
> exec 'perl m.pl';
>
> Please tell me what could be the problem.
>
> I am using Perl 5.8.0 under Windows 2000 with Apache
> 2.0.44.
>
> Thank you.
>
> Teddy,
> Teddy's Center: http://teddy.fcc.ro/
> Email: orasnita@...
>
>
>
> Unsubscribing info is here:
> http://help.yahoo.com/help/us/groups/groups-32.html
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/






________________________________________________________________________
________________________________________________________________________

Message: 5
Date: Fri, 31 Jan 2003 12:12:00 +0200
From: "Octavian Rasnita"
Subject: Re: Perl error

I've tried that, but it is the same.
I've cut the script to see where is the problem and I found it though I
don't know how to solve it.

The problem is in the DBI module.

If I use the following script, it gives me that error.
If I comment out the line
use DBI;
then the script works fine.

Here is the script:

#!/perl/bin/perl

use DBI;

print "Content-type: text/html\n\n";

$| = 1;
my $pid;

if ($pid = fork()) {

}
elsif (defined $pid) {

}
else {

}

I use Perl 5.8.0 under Windows 2000.
I guess it might be a bug in the DBI module, or... I don't know.

I don't even know where to report it, because I'm sure it is a bug
somewhere.

Thank you.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: orasnita@...

----- Original Message -----
From: "Jenda Krynicky"
To:

Sent: Thursday, January 30, 2003 7:11 PM
Subject: Re: [PBML] Perl error


From: Ben Maynard


> Someone is bound to correct me on this but as I recall
> the fork function has some major issues on win32
> platforms ie. it doesn't work.

Well it does work. Kind of. It just does something a little different
because the underlying OS is different. Same for exec().

> --- Octavian Rasnita wrote: > Hi
> all,
> >
> > I've tried to use a fork function in a CGI program
> > to run another perl
> > script, but it gives me a bad error:
> >
> > perl.exe - Application Error The instruction at
> > "0x28068533" referenced
> > memory at "0x00000004". The memory could not be
> > "read". Click on OK to
> > terminate the program Click on CANCEL to debug the
> > program OK Cancel
> >
> > Here is the part of the script that forks (without
> > it, the program works
> > fine):
> >
> > $| = 1;
> > $SIG{CHLD} = "IGNORE";
> > fork;
> > close STDOUT;close STDIN;close STDERR;
> > exec 'perl m.pl';
> >
> > Please tell me what could be the problem.

Are you aware of the fact that you execute the exec() in BOTH
threads/processes? Try to only exec() in the child as shown in the
Ben's example.

Jenda
===== Jenda@... === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/







________________________________________________________________________
________________________________________________________________________



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!

[Non-text portions of this message have been removed]

#13585 From: gordon <gordon@...>
Date: Sat Feb 1, 2003 6:30 pm
Subject: Stripping newlines etc...
gordonisnz
Send Email Send Email
 
Hi there, Ive got a POP script etc.. & using it to pop my email & retrieve
the email text..

Anyway, Ive put each message into a @variable & looping through the lines
etc..

However - in my email programme, I'm sending :-

A relativly short line here -  and
here is another line _ similar, but a lot longer although im not using any
return/enter keys.


anyway, it processes the short line ok - However, On my screen, the long
line is just that - one lone line of text.
But when retrieved through the perl script, the line is split into two
seperate lines.. & this, the 2nd line 'fails' the criteria, & doesnt process..
(each line is in a format, But can be varying lengths)..

QUESTION :-

Is there a way to 'strip' the computer-generated hard-returns, but keep the
returns/enter keys that are manually entered by me ?


SUMMARY :-
Im designing an email script so I can do various simple tasks / maintenance
on my site via email - reduce bandwith & screens to view etc..


If there isnt any easy way to do the above, I can adjust the script a bit,
To put each variable on a different line etc..

G.

#13586 From: "picsian1 <imoq172@...>" <imoq172@...>
Date: Sun Feb 2, 2003 2:37 am
Subject: Sendmail
picsian1
Send Email Send Email
 
Hello all
I'm using sendmail and I've got it coded like this:


open(MAIL, "|/usr/sbin/sendmail -oi -t ") ||  Error ('open', 'mail
program');
select (MAIL);
print << "EOF";
To: $postInputs{'Email'}
From: $Contact
Subject: Testing

$time
First Name: $postInputs{'First'}
Last Name: $postInputs{'Last'}
Address: $postInputs{'Address'}

EOF

close(MAIL);
select (STDOUT);



Pretty standard. The $Contact in the From: is a string like so:
$Contact=$postInputs{'First'} . ' ' . $postInputs{'Last'} ;

When I get the email, the From address shows up as :

Howard.Hunt@...

Howard.Hunt is coming from the $Contact, but where is the
@megawebservers.com  coming from? I'd like to change it to my
domain. How would I do that?

Your help is greatly appreciated.

Gary

#13587 From: "Charles K. Clarkson" <cclarkson@...>
Date: Sun Feb 2, 2003 5:45 am
Subject: RE: [PBML] Sendmail
charlesclarkson
Send Email Send Email
 
picsian1 <imoq172@...> wrote:

: When I get the email, the From address shows up as :
:
: Howard.Hunt@...
:
: Howard.Hunt is coming from the $Contact, but where
: is the @megawebservers.com  coming from? I'd like
: to change it to my domain. How would I do that?

     The "@megawebservers.com" might be coming from
sendmail because someone has turned on the
"always_add_domain" feature:
http://www.tek-tips.com/gviewthread.cfm/lev2/3/lev3/15/pid/14/qid/436479

     Have you tried to send the email with the domain
you want added on to $Contact? Your example seems to
indicate that you are not sending the domain name in
$Contact, but you don't actually say that.

$Contact .= '@...'


     This is a sendmail issue, not a perl programming
issue. Have you tried USENET: news:comp.mail.sendmail?
Search at groups.google before asking your question.


HTH,

Charles K. Clarkson
--
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328

#13588 From: "Jadi, SoftHome" <jadi@...>
Date: Sun Feb 2, 2003 11:21 am
Subject: a simple question...
jadijan
Send Email Send Email
 
hI, Can real beginners ask questions ? :)
I want to browse a String char by char. I've used to
do in C this way :

   for (int i, i<length(str), i++)
         str[i]='A';

how can I access to the n'th char in a string ? I'm using

    substr $str, $n, 1;

but there must be a better way.

Jadi


[Non-text portions of this message have been removed]

#13589 From: Krishnakant Mane <cssperl@...>
Date: Sun Feb 2, 2003 11:37 am
Subject: Challenge in Creating reports
cssperl@...
Send Email Send Email
 
Hello every one.

A few days back I had inquired about printing to a printer.  I still don't
understand how to send output to the printer.  Any help in this regard will be
welcomed.  I want to know how to access the default printer and how to allow
user to select another printer.

My main question however is that if perl was initialy ment for reporting etc.
then how is it actually done.  I want to create grid like format for reports. 
When I display the report in a tabular format I want grid lines between the
columns.  Secondly I want to know how can I change the attributes like bold and
italics underline etc.  Is there any way to change the fonts also.  And most
importantly the size of the font.

Please mail back as I am on a very inovative expriment.  I have created a
software in VB and through the call of shell() function I am going to call this
perl script to print to the printer.  I know how to run the scripts with the
shell() function only I don't know how to create reports.

Thanks.

Krishnakant.




---------------------------------
With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your
needs


[Non-text portions of this message have been removed]

#13590 From: "picsian1 <imoq172@...>" <imoq172@...>
Date: Sun Feb 2, 2003 6:30 pm
Subject: Re: [PBML] Sendmail
picsian1
Send Email Send Email
 
Charles,
Thank you for responding. You're dead-on!. You must include the
domain at the end.
Thanks again.
gary

--- In perl-beginner@yahoogroups.com, "Charles K. Clarkson"
<cclarkson@h...> wrote:
> picsian1 <imoq172@h...> wrote:
>
> : When I get the email, the From address shows up as :
> :
> : Howard.Hunt@m...
> :
> : Howard.Hunt is coming from the $Contact, but where
> : is the @megawebservers.com  coming from? I'd like
> : to change it to my domain. How would I do that?
>
>     The "@megawebservers.com" might be coming from
> sendmail because someone has turned on the
> "always_add_domain" feature:
> http://www.tek-
tips.com/gviewthread.cfm/lev2/3/lev3/15/pid/14/qid/436479
>
>     Have you tried to send the email with the domain
> you want added on to $Contact? Your example seems to
> indicate that you are not sending the domain name in
> $Contact, but you don't actually say that.
>
> $Contact .= '@...'
>
>
>     This is a sendmail issue, not a perl programming
> issue. Have you tried USENET: news:comp.mail.sendmail?
> Search at groups.google before asking your question.
>
>
> HTH,
>
> Charles K. Clarkson
> --
> Head Bottle Washer,
> Clarkson Energy Homes, Inc.
> Mobile Home Specialists
> 254 968-8328

#13591 From: "picsian1 <imoq172@...>" <imoq172@...>
Date: Sun Feb 2, 2003 6:38 pm
Subject: Writing to a file using STDOUT
picsian1
Send Email Send Email
 
Hello all
This is pretty elementary but I can't seem to get it to work.
Perhaps one of you eagle eyes can spot where I'm going wrong. I'm
appending records to a text file. I've read data from a form and I
assemble it into a line to output and write it out. All goes well.
Here's what the code looks like... (TEMP if file handle):

$_= $postInputs{'First'} . "\t" ;
$_= $_ . $postInputs{'Last'} . "\t" ;
$_= $_ . $postInputs{'Address'} . "\t" ;
$_= $_ . $postInputs{'Email'} . "\n" ;
print TEMP $_;

This works great. Now I wanted to insert an amount field in this
record so I coded:

my $amt='$35.00';

Then

$_= $postInputs{'First'} . "\t" ;
$_= $_ . $postInputs{'Last'} . "\t" ;
$_= $_ . $postInputs{'Address'} . "\t" ;
$_= $_ . $amt . "\t" ;
$_= $_ . $postInputs{'Email'} . "\n" ;
print TEMP $_;

When I examine the output file, there is no field with
value '$35.00'. Just the tab char. where the $amt field should be.
Can anyone spot where I'm going wrong or how can I get it to work.
Your help is greatly appreciated.

Gary

#13592 From: "Charles K. Clarkson" <cclarkson@...>
Date: Sun Feb 2, 2003 7:27 pm
Subject: RE: [PBML] Writing to a file using STDOUT
charlesclarkson
Send Email Send Email
 
picsian1 <imoq172@...> wrote:
:
: Now I wanted to insert an amount field in this
: record so I coded:
:
: my $amt='$35.00';
:
: Then
:
: $_= $postInputs{'First'} . "\t" ;
: $_= $_ . $postInputs{'Last'} . "\t" ;
: $_= $_ . $postInputs{'Address'} . "\t" ;
: $_= $_ . $amt . "\t" ;
: $_= $_ . $postInputs{'Email'} . "\n" ;
: print TEMP $_;
:
: When I examine the output file, there is no
: field with value '$35.00'. Just the tab char.
: where the $amt field should be. Can anyone
: spot where I'm going wrong or how can I get
: it to work.

    Worked for me:

#!/usr/local/bin/perl

my %postInputs = (
	 First   => 'John',
	 Last    => 'Public',
	 Address => '123 Easy Street',
	 Email   => 'JQ@...',
);

my $amt = '$35.00';

$_= $postInputs{'First'} . "\t" ;
$_= $_ . $postInputs{'Last'} . "\t" ;
$_= $_ . $postInputs{'Address'} . "\t" ;
$_= $_ . $amt . "\t" ;
$_= $_ . $postInputs{'Email'} . "\n" ;

print $_;

__END__

prints:

John Public 123 Easy Street $35.00 JQ@...


     Are you sure there are no syntax
errors in your code? Perhaps you didn't
Cut & Paste your exact code to the message.


HTH,

Charles K. Clarkson
--
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328

#13593 From: Dustin Smith AKA GIDustin <dustin@...>
Date: Sun Feb 2, 2003 10:47 pm
Subject: Simple Chomping question
gidustin
Send Email Send Email
 
I have an array, and each element has a newline at the end.  How can I get rid
of the newline after each element without making a loop to rebuild each element?

I was hoping that @data = chomp(@data); would work, but it didnt appear to.

Thanks

GIDustin

--
My Home Page:  http://www.gidustin.net
Alternate:     http://www.civ3files.com
--
When NASA first started sending up astronauts, they quickly discovered that
ballpoint pens would not work in zero gravity. To combat the problem, NASA
scientists spent a decade and 12 Billion Dollars to develop a pen that writes
in zero gravity, upside down, underwater, on almost any surface including glass
and at temperatures ranging from below freezing to 300C.

The Russians just used a pencil.
--
The 10 Commandments consit of 279 words.
The Declaration of Independence is 300 words long.
The EU Ordinance on the Import of Caramel Sweets consists of 25911 words...

#13594 From: Dustin Smith AKA GIDustin <dustin@...>
Date: Sun Feb 2, 2003 10:50 pm
Subject: Re: Simple Chomping Question
gidustin
Send Email Send Email
 
duh, NM  I got it.

instead of
@data = chomp(@data);

it should just be
chomp(@data);

GIDustin

--
My Home Page:  http://www.gidustin.net
Alternate:     http://www.civ3files.com
--
When NASA first started sending up astronauts, they quickly discovered that
ballpoint pens would not work in zero gravity. To combat the problem, NASA
scientists spent a decade and 12 Billion Dollars to develop a pen that writes
in zero gravity, upside down, underwater, on almost any surface including glass
and at temperatures ranging from below freezing to 300C.

The Russians just used a pencil.
--
The 10 Commandments consit of 279 words.
The Declaration of Independence is 300 words long.
The EU Ordinance on the Import of Caramel Sweets consists of 25911 words...

#13595 From: Nathan.Jeffrey@...
Date: Sun Feb 2, 2003 11:32 pm
Subject: Re: [PBML] Challenge in Creating reports
Nathan.Jeffrey@...
Send Email Send Email
 
Really, I think you should be looking at the format() and write() calls.
It should be able to do something very close to what it sounds like you're
after.

perldoc -f format
perldoc -f write

Yours,
Nathan





Krishnakant Mane <cssperl@...>
02/02/2003 10:37 PM
Please respond to perl-beginner


         To:     perl-beginner@yahoogroups.com
         cc:
         Subject:        [PBML] Challenge in Creating reports



Hello every one.

A few days back I had inquired about printing to a printer.  I still don't
understand how to send output to the printer.  Any help in this regard
will be welcomed.  I want to know how to access the default printer and
how to allow user to select another printer.

My main question however is that if perl was initialy ment for reporting
etc. then how is it actually done.  I want to create grid like format for
reports.  When I display the report in a tabular format I want grid lines
between the columns.  Secondly I want to know how can I change the
attributes like bold and italics underline etc.  Is there any way to
change the fonts also.  And most importantly the size of the font.

Please mail back as I am on a very inovative expriment.  I have created a
software in VB and through the call of shell() function I am going to call
this perl script to print to the printer.  I know how to run the scripts
with the shell() function only I don't know how to create reports.

Thanks.

Krishnakant.




---------------------------------
With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits
your needs


[Non-text portions of this message have been removed]


Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/







________________________________________________________________________________\
_

This email contains confidential information intended only for the person named
above and may be subject to legal privilege. If you are not the intended
recipient, any disclosure, copying or use of this information is prohibited. The
Department provides no guarantee that this communication is free of virus or
that it has not been intercepted or interfered with. If you have received this
email in error or have any other concerns regarding its transmission, please
notify Postmaster@...
________________________________________________________________________________\
_

#13596 From: Nathan.Jeffrey@...
Date: Sun Feb 2, 2003 11:38 pm
Subject: Re: [PBML] a simple question...
Nathan.Jeffrey@...
Send Email Send Email
 
That's probably the way I'd do it....

my $str = "foobarbaz";
my $i;
for ( $i = 0, $i < length($str), $i++ ) {
         # NB, brackets added for clarity
         print( substr($str, $i, 1), "\n" );
}

N





"Jadi, SoftHome" <jadi@...>
02/02/2003 10:21 PM
Please respond to perl-beginner


         To:     "Perl Beginner" <perl-beginner@yahoogroups.com>
         cc:
         Subject:        [PBML] a simple question...


hI, Can real beginners ask questions ? :)
I want to browse a String char by char. I've used to
do in C this way :

   for (int i, i<length(str), i++)
         str[i]='A';

how can I access to the n'th char in a string ? I'm using

    substr $str, $n, 1;

but there must be a better way.

Jadi


[Non-text portions of this message have been removed]


Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/







________________________________________________________________________________\
_

This email contains confidential information intended only for the person named
above and may be subject to legal privilege. If you are not the intended
recipient, any disclosure, copying or use of this information is prohibited. The
Department provides no guarantee that this communication is free of virus or
that it has not been intercepted or interfered with. If you have received this
email in error or have any other concerns regarding its transmission, please
notify Postmaster@...
________________________________________________________________________________\
_

#13597 From: "Octavian Rasnita" <orasnita@...>
Date: Sun Feb 2, 2003 6:01 pm
Subject: Re: [PBML] a simple question...
orasnita
Send Email Send Email
 
Why isn't "substr()" function good enough?

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: orasnita@...

----- Original Message -----
From: "Jadi, SoftHome" <jadi@...>
To: "Perl Beginner" <perl-beginner@yahoogroups.com>
Sent: Sunday, February 02, 2003 1:21 PM
Subject: [PBML] a simple question...


hI, Can real beginners ask questions ? :)
I want to browse a String char by char. I've used to
do in C this way :

   for (int i, i<length(str), i++)
         str[i]='A';

how can I access to the n'th char in a string ? I'm using

    substr $str, $n, 1;

but there must be a better way.

Jadi


[Non-text portions of this message have been removed]


Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

#13598 From: "grappling_machine <faison09@...>" <faison09@...>
Date: Mon Feb 3, 2003 5:32 am
Subject: Help please , thanks in advance
grappling_ma...
Send Email Send Email
 
I am writing a simple rock paper scissors game in perl but i am
having problems with the output. after i enter "rock for example my
program just starts over without going through my conditionals.

         #!/usr/bin/perl







print ("This is the classic game Rock Paper Scissors");


#create random number
my $target = rand()*3;


#subroutine
sub rpscissors {

my $i;

# need to get input from user.
$userchoice eq <>;

chop($userchoice);
$userchoice;
print $userchoice;
# the results
# if cpu chooses 0 = rock , 1 = paper 2 = scissors
if ($userchoice eq "rock"){
     if ($target == 0){
    print("Computer picked ROCK it's a draw");
   }
    elsif ($target == 1){
    print ("Computer picked PAPER you lose");
   }
   elsif ($target == 2){
   print ("Computer picked SCISSORS you win!!");
   }# end if
   }

   if ($userchoice eq "paper"){
     if ($target == 1){
   print ("Computer picked PAPER it's a draw");
   }
     elsif ($target == 2){
   print ("Computer picked SCISSORS you lose");
   }
     elsif ($target == 0){
   print("Computer picked ROCK you win!!");
   }#end elsif
   }#end if



if ($userchoice eq "scissors"){

     if ($target == 2){
   print ("Computer picked SCISSORS it's a draw");
   }
   elsif ($target == 0){
   print ("Computer picked ROCK you lose");
   }
   elsif ($target == 1){
   print("Computer picked PAPER you win");
   }#end elsif
   }#end if
   }#end sub
   &rpscissors;

#13599 From: "Octavian Rasnita" <orasnita@...>
Date: Mon Feb 3, 2003 3:39 am
Subject: Re: [PBML] Simple Chomping question
orasnita
Send Email Send Email
 
Have you tried:

chomp @array;

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: orasnita@...

----- Original Message -----
From: "Dustin Smith AKA GIDustin" <dustin@...>
To: <perl-beginner@yahoogroups.com>
Sent: Monday, February 03, 2003 12:47 AM
Subject: [PBML] Simple Chomping question


I have an array, and each element has a newline at the end.  How can I get
rid
of the newline after each element without making a loop to rebuild each
element?

I was hoping that @data = chomp(@data); would work, but it didnt appear to.

Thanks

GIDustin

--
My Home Page:  http://www.gidustin.net
Alternate:     http://www.civ3files.com
--
When NASA first started sending up astronauts, they quickly discovered that
ballpoint pens would not work in zero gravity. To combat the problem, NASA
scientists spent a decade and 12 Billion Dollars to develop a pen that
writes
in zero gravity, upside down, underwater, on almost any surface including
glass
and at temperatures ranging from below freezing to 300C.

The Russians just used a pencil.
--
The 10 Commandments consit of 279 words.
The Declaration of Independence is 300 words long.
The EU Ordinance on the Import of Caramel Sweets consists of 25911 words...

Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

#13600 From: "Charles K. Clarkson" <cclarkson@...>
Date: Mon Feb 3, 2003 6:05 am
Subject: RE: [PBML] a simple question...
charlesclarkson
Send Email Send Email
 
Jadi, SoftHome [jadi@...] wrote:

:
: I want to browse a String char by char. I've used to
: do in C this way :
:
:   for (int i, i<length(str), i++)
:         str[i]='A';
:
: how can I access to the n'th char in a string ? I'm using
:
:    substr $str, $n, 1;
:
: but there must be a better way.

     No. substr is about the fastest way to do it. What
are you trying to accomplish?

#13601 From: "Franki" <frankieh@...>
Date: Mon Feb 3, 2003 6:11 am
Subject: RE: [PBML] Simple Chomping question
frankhauptle
Send Email Send Email
 
Thats a good question...

I would imagine that chomp @array would not have the desired result.

so I think this:

foreach my $item (@array)
{
$item = chomp $item;
}

would do the job easily enough...

but wouldn't it be easier to chomp the data before you put it in the
array???

rgds

Frank

-----Original Message-----
From: Octavian Rasnita [mailto:orasnita@...]
Sent: Monday, 3 February 2003 11:40 AM
To: perl-beginner@yahoogroups.com
Subject: Re: [PBML] Simple Chomping question


Have you tried:

chomp @array;

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: orasnita@...

----- Original Message -----
From: "Dustin Smith AKA GIDustin" <dustin@...>
To: <perl-beginner@yahoogroups.com>
Sent: Monday, February 03, 2003 12:47 AM
Subject: [PBML] Simple Chomping question


I have an array, and each element has a newline at the end.  How can I get
rid
of the newline after each element without making a loop to rebuild each
element?

I was hoping that @data = chomp(@data); would work, but it didnt appear to.

Thanks

GIDustin

--
My Home Page:  http://www.gidustin.net
Alternate:     http://www.civ3files.com
--
When NASA first started sending up astronauts, they quickly discovered that
ballpoint pens would not work in zero gravity. To combat the problem, NASA
scientists spent a decade and 12 Billion Dollars to develop a pen that
writes
in zero gravity, upside down, underwater, on almost any surface including
glass
and at temperatures ranging from below freezing to 300C.

The Russians just used a pencil.
--
The 10 Commandments consit of 279 words.
The Declaration of Independence is 300 words long.
The EU Ordinance on the Import of Caramel Sweets consists of 25911 words...

Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/





Unsubscribing info is here:
http://help.yahoo.com/help/us/groups/groups-32.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

#13602 From: "Charles K. Clarkson" <cclarkson@...>
Date: Mon Feb 3, 2003 6:21 am
Subject: RE: [PBML] Help please , thanks in advance
charlesclarkson
Send Email Send Email
 
grappling_machine <faison09@...> wrote:

: I am writing a simple rock paper scissors game
: in perl but i am having problems with the output.
: after i enter "rock for example my program just
: starts over without going through my
: conditionals.
:
: #!/usr/bin/perl
:
: print ("This is the classic game Rock Paper Scissors");
:
:
: #create random number
: my $target = rand()*3;

     Try testing this part with:

#!/usr/bin/perl

print rand() * 3, "\n" for 1 .. 10;

__END__

     It is unlikely you will get any integers.

Now try:

#!/usr/bin/perl

print int rand() * 3, "\n" for 1 .. 10;

__END__

    See the difference. Your conditionals are checking
for integers. When you can't find a solution to an
error look at the inputs.


  Finagle's Third Law:

     "In any collection of data, the figure most
      obviously correct, beyond all need of
      checking, is the mistake."


my $target = int rand() * 3;



HTH,

Charles K. Clarkson
--
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328

#13603 From: "Jadi, SoftHome" <jadi@...>
Date: Mon Feb 3, 2003 6:51 am
Subject: Re: [PBML] Help please , thanks in advance
jadijan
Send Email Send Email
 
there are 2 errors in your code... this is the first one :

: : my $target = rand()*3;

when you use rand, the result will be a floating point number
( say 1.857493 ) so you have to use "int" :

         my $target = int (rand()*3);

so "int ( 1.857493 )"  will be " 1 ";

and this is the seccond mistake :

:: $userchoice eq <>;

"eq" means "is it equal ?" when you want to say "make it equal"
you have to use " = " instead...

    $userchoice = <>;

and your programmed will work great :

    This is the classic game Rock Paper Scissors
    > rock
    jadi : rock     cpu : 2
    Computer picked SCISSORS you win!!

as you can see I've added some more lines and \n to it !


Jadi

#13604 From: "picsian1 <imoq172@...>" <imoq172@...>
Date: Mon Feb 3, 2003 7:36 am
Subject: Re: [PBML] Writing to a file using STDOUT - Solved by Charles
picsian1
Send Email Send Email
 
Charles,

Thank you for wanting to help again. Your response did help a lot. I
spent at least 4 hrs looking at that one before posting it. Then
after your response I keyed in your little rountine. It worked for
me too. So I scrutinzed my code for the umpteeneth time. Yep. I got
the little devil this time. The $amt field was null at the time I
wrote the record. It was getting initalized AFTER the write
operation. Sigh. Thanks a bunch Charles!

Best Regards

Gary


--- In perl-beginner@yahoogroups.com, "Charles K. Clarkson"
<cclarkson@h...> wrote:
> picsian1 <imoq172@h...> wrote:
> :
> : Now I wanted to insert an amount field in this
> : record so I coded:
> :
> : my $amt='$35.00';
> :
> : Then
> :
> : $_= $postInputs{'First'} . "\t" ;
> : $_= $_ . $postInputs{'Last'} . "\t" ;
> : $_= $_ . $postInputs{'Address'} . "\t" ;
> : $_= $_ . $amt . "\t" ;
> : $_= $_ . $postInputs{'Email'} . "\n" ;
> : print TEMP $_;
> :
> : When I examine the output file, there is no
> : field with value '$35.00'. Just the tab char.
> : where the $amt field should be. Can anyone
> : spot where I'm going wrong or how can I get
> : it to work.
>
>    Worked for me:
>
> #!/usr/local/bin/perl
>
> my %postInputs = (
>  First   => 'John',
>  Last    => 'Public',
>  Address => '123 Easy Street',
>  Email   => 'JQ@a...',
> );
>
> my $amt = '$35.00';
>
> $_= $postInputs{'First'} . "\t" ;
> $_= $_ . $postInputs{'Last'} . "\t" ;
> $_= $_ . $postInputs{'Address'} . "\t" ;
> $_= $_ . $amt . "\t" ;
> $_= $_ . $postInputs{'Email'} . "\n" ;
>
> print $_;
>
> __END__
>
> prints:
>
> John Public 123 Easy Street $35.00 JQ@a...
>
>
>     Are you sure there are no syntax
> errors in your code? Perhaps you didn't
> Cut & Paste your exact code to the message.
>
>
> HTH,
>
> Charles K. Clarkson
> --
> Head Bottle Washer,
> Clarkson Energy Homes, Inc.
> Mobile Home Specialists
> 254 968-8328

#13605 From: "diheptal <diheptal@...>" <diheptal@...>
Date: Mon Feb 3, 2003 2:33 pm
Subject: substituting white space with a character [i.e .a backslash].
diheptal
Send Email Send Email
 
can anyone change code below a bit?

what this does to a plain text file is overwrite all the
characters with backslashes. it does not at present overwrite
any whitespace.

what i am trying to do is -

1. if there is one whitespace [or more] at the end of a line:
    replace with one [and one only] backslash.

1.a. if no whitespace at the end:
      add one backslash.

2. if there is any leading whitespace [i.e. start of line]:
    leave it intact [i.e. do not substitute with backslashes].

3. any internal white space in a line, i.e. between words:
    substitute with the same number of backslashes:
    [i.e. a one for one substitution]


This is my code: i'm working in microsoft until i sort out my
free software situation
[really, it's going to happen...]:

wayne
                   ############

#!/usr/bin/perl -w

open(F1, "C:\\Windows\\Desktop\\Wayne\\sentence.txt") || die;

open(F2, ">C:\\Windows\\Desktop\\Wayne\\sentencem3.txt") || die;


    while(<F1>)
    {
       ($line = $_) =~ s/[^\ \s+]/\\/g;

print F2 $line;
    }

close(F1);
close(F2);

#13606 From: "Jenda Krynicky" <Jenda@...>
Date: Mon Feb 3, 2003 2:47 pm
Subject: Re: [PBML] Perl error
jendaperl
Send Email Send Email
 
From: "Octavian Rasnita" <orasnita@...>
> I've tried that, but it is the same.
> I've cut the script to see where is the problem and I found it though
> I don't know how to solve it.
>
> The problem is in the DBI module.
>
> If I use the following script, it gives me that error.
> If I comment out the line
> use DBI;
> then the script works fine.

What version of DBI do you have?
This DOES look like a problem in DBI, but I think this has already
been solved in the newest version.

Would it be possible to use DBI only in one thread and only AFTER the
fork()? I have a service with two threads in 5.6.1 (build 631) and it
works very fine this way. The easiest way is to have one "main"
script that does whatever startup necessary (in my case creates some
semaphores and a pipe), fork()s and requires a different script in
parent and child. As long as I use DBI and DBD::ODBC only in one
thread it worked all right.

Jenda
===== Jenda@... === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
	 -- Terry Pratchett in Sourcery

#13607 From: David Driscoll <ddriscoll@...>
Date: Mon Feb 3, 2003 5:50 pm
Subject: installing a module
ddriscoll@...
Send Email Send Email
 
Hi,
I'm trying to install the DB_File module on a hp-ux 11.0 system with perl
5.6.1 on it. I've tried both swinstal and MCPAN and it gets to the make step
and stops because it can't find db.h. I have db.h in both /usr/include/sys
and /usr/conf/h/.
What am I supposed to do now? Add one of these directories to my path?
Copy db.h somewhere? Edit Makefile.PL?
Any help would be apprieciated.
Dave Driscoll ddriscoll@...

#13608 From: "Jenda Krynicky" <Jenda@...>
Date: Mon Feb 3, 2003 3:55 pm
Subject: Re: [PBML] installing a module
jendaperl
Send Email Send Email
 
From: David Driscoll <ddriscoll@...>
> I'm trying to install the DB_File module on a hp-ux 11.0 system with
> perl 5.6.1 on it. I've tried both swinstal and MCPAN and it gets to
> the make step and stops because it can't find db.h. I have db.h in
> both /usr/include/sys and /usr/conf/h/. What am I supposed to do now?
> Add one of these directories to my path? Copy db.h somewhere? Edit
> Makefile.PL? Any help would be apprieciated.

You are supposed to read the README file from the DB_File archive :-)
It will tell you to update Config.in to contain proper paths to your
db.h and the dblib library.

Jenda
===== Jenda@... === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
	 -- Terry Pratchett in Sourcery

#13609 From: "carpetony <carpetony@...>" <carpetony@...>
Date: Mon Feb 3, 2003 4:10 pm
Subject: FormMail-one form works the other = Bad Referrers--simpler SEND script
carpetony
Send Email Send Email
 
Any one have any ideas why one of my forms works, yet the other one
after several attempts to tidy up @referrers, doesn't want to work?

the working form is:

http://stockade.org/about/contact.shtml

the NOT working form starts:

http://www.stockade.org/guestbook2/entry.html


if someone knows any way i can do this better:

what i want to do, is have the data in the following form

http://www.stockade.org/guestbook2/reserve_temp.shtml

to layed out in HTML format so we can print it easier at work.  i
created a perl script that does it, the resutls can be seen in:

http://www.stockade.org/guestbook2/entry.html

i use that table layout to confirm the reservation, and to send via
FormMail, but it's not working how i'd like.

does anyone have a simpler version of FormMail i could use?

#13610 From: "prakash" <prakash@...>
Date: Mon Feb 3, 2003 6:49 pm
Subject: hashref concat..
prakash@...
Send Email Send Email
 
one of my module has the following code...

$sth = $dbh->prepare("select * from email where user_id=\'$userid\' and
pros_email=\'$email\'") || return $DBI::errstr;
$sth->execute || return $DBI::errstr;
$info=$sth->fetchrow_hashref('NAME_uc');
$sth = $dbh->prepare("select * from category where
cate_id=\'$info->{CATE_ID}\'") || return $DBI::errstr;
$sth->execute || return $DBI::errstr;

#########when i do this info before is over written.. i want to append...
$info = $sth->fetchrow_hashref('NAME_uc');
closeDB();
######### this works fine...
$info->{ORG_USERNAME}=$obj->sElect("select org_username from category where
cate_id=\'$info->{CATE_ID}\'");


return $info;


anybody have solution fo all all in the

#13611 From: "grappling_machine <faison09@...>" <faison09@...>
Date: Mon Feb 3, 2003 8:26 pm
Subject: string concantenation
grappling_ma...
Send Email Send Email
 
I am trying to get my variables $cpuscore and $userscore to print but
it keeps printing them literally as strings and not variables.
Any help would be appreciated.

thanks
  Shawn


print "computer score: $cpuscore\n User Score: $userscore\n";

Messages 13582 - 13611 of 27470   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help