This may help..a very basic file I/O
open(INFILE,yourfile);
open (OUTFILE,outfilename);
while ($line=INFILE) {
chomp $line;
next if ($line eq );
print OUTFILE $line;
}
You could also slurp it into an array, but
- Original Message -
From: Kim, Kiseok [EMAIL PROTECTED]
To: [EMAIL
At 02:29 PM 4/1/02 +0200, Toomas Vendelin wrote:
First, your suggestion presumes that the other end webmaster has to
have at least an elementary understanding of Unix, permissions, and
other command-line stuff which is, true, quite simple, but can make a
FrontPage
weekend user hysterically
Hello Marty,
Thanks for advice. Honestly, I haven't considered this possibility,
and now I am thinking why.
First, your suggestion presumes that the other end webmaster has to
have at least an elementary understanding of Unix, permissions, and
other command-line stuff which is, true, quite
Hi all,
I have a number with a lot of decimals but I want to have it only with 1 or
2.
I don't want 3.1415... etc, but only 3.1 or 3.14.
Can you give me some hints what should I do?
Thank you.
Teddy,
My dear email address is [EMAIL PROTECTED]
First of all is there a website that you recommend as a reference guide or
manual to topics like what you are explaining below?
Second, how does one go about tying in a cgi script to a submit button and
how would I go about making the 'submit' button capable of deleting a table
when a user
You can use Format:Number module to make such kind of modifications, or you
can write fonctions for it but it 'll take more time sure:)
funky from Istanbul
- Original Message -
From: Octavian Rasnita [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 01, 2002 12:36 PM
Subject:
Why not use the sprintf or printf function?
# Assigns 3.14 to the $decimal variable
my $decimal = 3.1415;
$decimal = sprintf('%.2f', $decimal);
# Prints 3.14
my $decimal = 3.1415;
printf('%.2f', $decimal);
# Prints 3.1
my $decimal = 3.1415;
printf('%.1f', $decimal);
You get the idea...
Best
Hi all
I have created a cgi-perl script for a web-site. I am using cookies and
mysql for database on a Linux box.
When my page is called in IE, it works great, but Netscape throws out the
whole HTML code.
Now, if I copy this code and save it in a file as xyz.html, it works perfect
in Netscape.
Octavian Rasnita
Hi all,
I have a number with a lot of decimals but I want to have it only with 1
or
2.
I don't want 3.1415... etc, but only 3.1 or 3.14.
Can you give me some hints what should I do?
Try:
my $var1=3.1415926;
my $roundedvar=sprintf %.2f, $var1;
print
You may try this as header :
print Content-type: text/html\n\n;
- Original Message -
From: Aman Raheja [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 02, 2002 1:13 AM
Subject: netscape problem !!!
Hi all
I have created a cgi-perl script for a web-site. I am using
Hi all,
Sorry this message is a little (or more) off topic.
I want to make a script for submitting a web site to more search engines.
Can you help me with such a script?
I don't have the addresses used for submitting and I would like to see a
code too.
Thank you very much.
Teddy,
My dear
On 4/1/02 9:13 AM, Aman Raheja [EMAIL PROTECTED] wrote:
Hi all
I have created a cgi-perl script for a web-site. I am using cookies and
mysql for database on a Linux box.
When my page is called in IE, it works great, but Netscape throws out the
whole HTML code.
Now, if I copy this code and
For the life of me, I cannot remember how to find the certain numbers in a
string. I remember how to find the length of an array but I cannot find how
to find the length of a string in a variable.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
hi guys,
The following cgi script works just fine when i run it from the command
prompt, but when i check using a browser the output is not displayed...it
gives error as document contained no data..can i use the system() function
in cgi as i have done below? the data itself is not fetched
Ron wrote:
For the life of me, I cannot remember how to find the certain numbers in a
string. I remember how to find the length of an array but I cannot find how
to find the length of a string in a variable.
perldoc -f length
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
Guys,
How can I check if the remote peer closed my TCP connection?
The following code is OK (taken from the book) because it expects something
to come from the peer:
use IO::Socket;
$sock = new IO::Socket::INET (LocalHost = 'goldengate',
On Sunday, March 31, 2002, at 07:07 , Jonathan E. Paton wrote:
[..]
I had not thought of the SWITCH case being one way or the other
in the OO v. Proceduralists approach - but your proposition does
present the problem - what is the tradeoff between 'runtime performance'
and
maintainability.
Good morning,
So I have modified my script a bit and it works. However, now
I want to not
read in the . and .. directories. How can I do this?? I am having
problems with this part.
I usually use the following code to do this:
opendir DIR,'$mydir'
or die couldn't open dir [$mydir]:
What if there is HUNDREDS of items, then
it'd be really slow. For a better approach
using hashes then see what I did in:
http://groups.yahoo.com/group/perl-beginner/message/9583
The question that now comes to mind is why
not put all of the 'response functions'
into a Perl Module -
On Fri, 2002-03-29 at 23:36, Jim Witte wrote:
I'm contemplating writing some software to scan through a large volume
of email (over 95 MB) to identify threads and remove quoted material.
Does anyone have any good references on algorithms to do text processing
like this for such a
On Monday, April 1, 2002, at 07:12 , Joe Echavarria wrote:
if (param())
{
$cate= param('categorias');
print The Param is --- es $cate;
};
while ($file = LISTA) {
($categoria,$link) = split(:,$file);
##this code is not working
if ($categoria eq $cate) {
print
when i try to excute your code over the brower i get
not output from the script, but when i execute the
script at command line i gets output.
why ?
--- drieux [EMAIL PROTECTED] wrote:
On Monday, April 1, 2002, at 07:12 , Joe Echavarria
wrote:
if (param())
{
$cate=
I'm trying to figure out how to exclude upload files with 2 periods
at the end (b/c of that virus which I forgot the name of, maybe
nimba?) Anyhow, this is what I have but it doesn't work. When I try
to submit with the double periods the test always results in false
and never gives the
if ($filename=~/(\w.\w\w\w.\w)$/)
This will match:
word charany char3 word charsany charword char
You need to escape the .
Jonathan Paton
__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music
Hi,
I have a datafile with a list of names like
Ana
John
Mike
Tracy
John
Luke
etc.
I don't know how long the list is and eventually in the list some of the
names will repeat. I want to put these names in an array but I don't want
to repeat any names in the array and I want to keep a
Hi there,
When i try to execute the script using the web
browser i get no output from it but at shell prompt it
works.
Here is the script :
#!/usr/bin/perl -w
use CGI qw/:all/;
print Content-type: text/html\n\n;
print title- LISTA DE LINKS -/title;
open(LISTA,links) or die Error :
Thank you Jenda! I acted defensively in my email response to you.
It's good to know about the 0, I never heard that before.
I guess it's me how should apologize.
Your second mail really sounded like you did not read my mail at
all and I overacted.
For unallowed chars:
1) almost always you do
The problem I am having is with $full
How do I get $login to return its value when I try to assign this scalar
$full
Thanks in advance
#!/util/perl5.static
$hostname = qx(/usr/ucb/hostname);
chomp $hostname;
%hosts = (
crane = hourihj,
runner = paulg,
ice = root,
);
Thanks, Jeff!
- B
__
On Mar 28, Bryan R Harris said:
- Why is the \1, \2, etc. syntax obsolete? The one thing I love about
regular expressions is that I can use them within text editors (nedit,
textpad, bbedit), but none of these support the $1 notation in the replace
Hi all,
Is there a way to do scp inside perl script?
Thanks,
Jeff Liu
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I find that
print Content-type: text/html\n\n;
doesnt always work. So I just use
print $CGI-header;
Regards,
Agustin Rivera
Webmaster, Pollstar.com / Pollstaronline.com
- Original Message -
From: Joe Echavarria [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 01,
Jeff:
Yes. Merely use something like:
system(scp Source Destination);
This would be the easiest way, or, also:
`scp Source Dest`;
More elaborate stuff can be done, but this is good for starters.
Best Regards,
Greg
-Original Message-
From: Jeff Liu [mailto:[EMAIL PROTECTED]]
Sent:
looks like '$login = print $hosts{$hostname};'
is not what you want.
'print' function returns '1' -- not the string it prints.
you want:
$login = $hosts{$hostname};
and if you really want to print the value:
print $login;
On Monday, April 1, 2002, at 08:30 AM, [EMAIL PROTECTED] wrote:
The
Hi Greg,
Thanks for your help.
But I have difficulty to fill in the password. What I like to do is,
open (SCP, | scp source destination);
print SCP scppassword;
close SCP;
Above code does not work for me. Any idea to make it work?
Best regards,
Jeff Liu
-Original Message-
From:
Allison, Check out pages 133 - 135 in Learning Perl (3rd Edition) - the
section AutoIncrement and Autodecrement section _ particularly the top of
page 135 has an example for just this very question! I just read that last
week so it popped right up in my mind.
If you don't have the book,
On Monday, April 1, 2002, at 08:15 , Joe Echavarria wrote:
that he was having problem with the cgi script -
amongst other things there is no 'start_html' in it
to make sure that it is set up correctly.
I would propose something on the order of the script at
the end, where I would isolate the
You could always put them into a hash and then put them into an array later.
foreach(@names){
$hash{$_} = 1;
}
my @array = keys %hash;
-Original Message-
From: Allison Ogle [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 8:08 AM
To: a a
Subject: Array question
Hi,
I have
On Monday, April 1, 2002, at 06:41 AM, David Gray wrote:
my fl = grep { $_ ne '.' and $_ ne '..' }, readdir DIR;
no comma after the block.
On Mon, 1 Apr 2002, Allison Ogle wrote:
I don't know how long the list is and eventually in the list some of
the names will repeat. I want to put these names in an array but I
don't want to repeat any names in the array and I want to keep a count
of how many times the name appears in the
Is it possible to do the reverse of a chmod? To get the permissions of a
given file as a number?
I'm creating a new file from an old one, and I'd like the new one to have
the same permissions as the old one. Is this possible?
TIA.
- B
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
Is it possible to do the reverse of a chmod?
Yes
To get the permissions of a given file as a number?
Same question twice!
I'm creating a new file from an old one, and I'd like the new one to have
the same permissions as the old one. Is this possible?
Same question trice!
You wanted to
Jeff:
I think you have the | in the wrong place. It should be
at the end of the line, as :
open(SCP,scp source dest|);
I think there is a way in ssh/scp to set up a similiar thing to
an rhosts. This is one way to be coding a password into a script.
That is the tradeoff of having some host
Here's my solution.
There will be shorter ways. I am new to perl, so this is how did it.
At the prompt do
$array-prob.pl datafile
#!/usr/bin/perl
#File name : array-prob.pl
my @arr;
while()
{
chomp($_);
$field{$_}++;
print $_ $field{$_}\n;
my $set = 0;
Is their a tool similar to ppm for Linux (Unix)?
You use a Windows machine and the golden rule is: Save, and save often.
It's scary how people have grown used to the idea that computers are
unreliable when it is not the computer at all - it's the operating system
that just doesn't cut it. -
Even, I put it like open(SCP,scp source dest|), the system still ask me to
type in my password. Probably, that's another shell, I mean the ssh login
shell is different from the one I run my script. So, I can not send my
password from previous shell to new ssh shell.
Thanks,
Jeff Liu
my apologies for sending long code illustrations.
in the future I will post them at:
http://www.wetware.com/drieux/CS/lang/Perl/Beginners/
and post up a URL to them.
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Sean,
Although it doesn't quite work the same as ppm, the cpan command will
enable you to install any package you desire. If you've never installed
it before, you'll need to use 'perl -MCPAN -e shell;' from the command
line, following the directions below. I recall hearing/reading that
this
perl -MCPAN -e shell
- Original Message -
From: Sean Hoskin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 01, 2002 11:13 AM
Subject: Equivalent Linux tool to ppm
Is their a tool similar to ppm for Linux (Unix)?
You use a Windows machine and the golden rule is: Save,
The beginner shines in me...
For reaping children,
I was thinking of send a signal to the entire group.
The gist is:
I want to attach a child to a FIFO, then have the parent start other
processes that read from the FIFO. The readers must be tricked into
thinking they are reading from files.
Thanks, Jonathan, Drieux!
- B
__
Is it possible to do the reverse of a chmod?
Yes
To get the permissions of a given file as a number?
Same question twice!
I'm creating a new file from an old one, and I'd like the new one to have
the same permissions as the old one.
On Mon, 2002-04-01 at 14:42, Rob Lee wrote:
I'd like to fork my program without waiting for the child to exit.
My child will be a sub with an infinite loop, so I'd like the parent to
continue on it's merry way.
Solutions?
-R
snip herf=perldoc -f fork
If you fork without ever waiting
Hello,
Is there a site freeware site blocking software for IE or netscape. I need
this for home use.
My ISP is hawk.com and I pay 9.00 per month.
__
William Ampeh (x3939)
Federal Reserve Board
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
On Monday, April 1, 2002, at 11:11 , Aman Raheja wrote:
$array-prob.pl datafile
p1: I loved the
$field{$_}++;
p2: but since you have stashed it all in a Hash, why not
unpack the hash with
my @arr = keys(%field);
the counter proposal
I was wondering if anyone knew how to increment a variable when the variable
is a letter. For example
$x=A;
$x++;
jep@delta:/ perl
$x = 'A';
print ++$x . \n;
B
jep@delta:/
Seems to work for me :) Remember the difference between preincrement and
postincrement, and what
happens when
works for me.
$a = A;
$a++;
print $a\n; # prints B
what version are you using? ++ is magical on letters in ver 5.500?+ I think.
Just remember that -- is not magical on letters, you will always get -1 from
that.
-Original Message-
From: Michael Stearman [mailto:[EMAIL PROTECTED]]
It could be my code. I am using the variable to write to an Excel file in
which I want to increment the cell from A1 to B1 to C1, etc.
$x=A;
foreach $list(@list) {
$cell=$x1;
$worksheet1-write($cell, $list);
$x++;
}
From: Michael Stearman [EMAIL PROTECTED]
To: [EMAIL
On Mon, 2002-04-01 at 16:03, Michael Stearman wrote:
It could be my code. I am using the variable to write to an Excel file in
which I want to increment the cell from A1 to B1 to C1, etc.
$x=A;
foreach $list(@list) {
$cell=$x1;
$worksheet1-write($cell, $list);
$x++;
It could be my code.
It is, trust me.
I am using the variable to write to an
Excel file in which I want to increment
the cell from A1 to B1 to C1, etc.
Generalising your code:
$x=A;
for (0..3) {
$cell=$x1;
print $cell . \n
$x++;
}
And what do you get?
By any
Micheal,
try this
$x = A;
foreach $list(@list) {
$cell = $x{1}; //you can't just put a suffix to a variable when
you print it..perl will think //you mean $x1.. use
$x{whateveryouwanttoadd} for example... $num = 4; print $sun{th}; //to
make it 4th
$worksheet-write($cell, $list);
Chas, no personal offense, but that code just looks ugly. I like the way
it's originally written by Mike.
So what version of perl are you using? perl -v
-Original Message-
From: Chas Owens [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 4:09 PM
To: Michael Stearman
Cc:
Good call..
use warnings;
use strict;
Too bad it took me 3 years to learn the benefits of using that and making it
a good habit to start all my programs with it.
-Original Message-
From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 4:14 PM
To: [EMAIL
On Monday, April 1, 2002, at 01:03 , Michael Stearman wrote:
$x=A;
foreach $list(@list) {
$cell=$x1;
$worksheet1-write($cell, $list);
$x++;
}
it's a 'scoping' bug - try
$cell = ${x}1;
this will generate your
A1
THANKS I have been looking for
Thanks for your help. I finally got it to work.
Allison
-Original Message-
From: drieux [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 3:44 PM
To: [EMAIL PROTECTED]
Subject: Re: Array question
On Monday, April 1, 2002, at 11:11 , Aman Raheja wrote:
$array-prob.pl datafile
Can someone help me decode this? or if not, please
recommend a good reference book or site for my
specific needs! thanks
i wrote this script for use of active perl installed
on win98 and used two modules
#!C:\Perl\bin -w
use HTML::Parse;
use HTML::FormatText;
# My question is here, insofar
No offense taken (TMTOWTDI). For debugging purposes I like to be able
to see entire functions (and sometimes more than one) on the screen at
the same time. With short loops like this one that means keeping it as
short and sweet as possible to maximize the amount of code visible at
one time. So
For debugging purposes I like to be able
to see entire functions (and sometimes
more than one) on the screen at the same
time. With short loops like this one that
means keeping it as short and sweet as
possible to maximize the amount of code
visible at one time.
Get a bigger monitor nmy
That's why you need to stop programming on your Palm Pilot. :)
-Original Message-
From: Chas Owens [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 1:33 PM
To: Nikola Janceski
Cc: [EMAIL PROTECTED]
Subject: Style issues (was RE: Increment a Variable)
No offense taken
Hello,
I have 2 independent perl programs p1 and p2. p1 calls p2 (using either the
system() or `` operators, and p2 will print
out status information every 2 seconds or so. How do I set it up such
that whenever p2 prints out data, it is printed out by p1 also IN REAL TIME?
Thanks.
On Monday 01 April 2002 02:25 pm, [EMAIL PROTECTED] wrote:
Is there a site freeware site blocking software for IE or netscape. I need
this for home use.
My ISP is hawk.com and I pay 9.00 per month.
If you wish to block out sites of questionable content to protect your
children, see internet
---BeginMessage---
Hi all,
How do you shadow/hide text. For example I have a small perl program in which it authenticates at launch to access an application:
print "ENTER USER NAME\n";$uname = ;
chomp($uname);
print "\n";
print "ENTER PASSWORD\n";
$pwd = ; #WOULD LIKE TO SHADOW THIS SCALAR
Hector Moran wrote:
How do you shadow/hide text. For example I have a small perl program
in which it authenticates at launch to access an application:
print ENTER USER NAME\n;
$uname = ;
chomp($uname);
print \n;
print ENTER PASSWORD\n;
$pwd = ; #WOULD LIKE TO SHADOW THIS SCALAR WITH
G'day All,
Just wondering how I would check the following variable against the hash
below?
sub read_data {
open USER_DATA, $USER_DATA or warn cannot open '$USER_DATA' for
reading: $!\n;
flock(USER_DATA, 2) || warn Can't lock $USER_DATA exclusively: $!;
while( $USER_DATA=USER_DATA
Jeff,
For ssh or scp not to ask for your password, you must create and exchange
keys. Check out O'Reilly's SSH The Secure Shell.
-Mike
-Original Message-
From: Jeff Liu [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 2:18 PM
To: Lirot, Gregory; Beginners
Subject: RE: scp
73 matches
Mail list logo