Hi there
I'm a new bird to Perl - and I have a little problem.
I have a file input where I split the file into an array and that works
fine, but there is some spam in the beginning of the file I want to
get rid of - the problem is that I never know how many lines there is
with this spam!
on Thu, 20 Jun 2002 18:16:59 GMT, Bo Mangor wrote:
I have a file input where I split the file into an array and that works
fine, but there is some spam in the beginning of the file I want to
get rid of - the problem is that I never know how many lines there is
with this spam!
Therefore I
Sorry, that was hasty...shoulda been something more like
my $file = '/path/to/file';
open(THEFILE,$file);
my @ary = THEFILE;
close(THEFILE);
for my $line(@ary) {
if($line !~ /^\d/) {
}
}
-Original Message-
From: Bo Mangor [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 20,
Hi again
Great thanks to all the quickly answers!
I tried a couple of them and - yes it works - thanks!
But how does it work? if(string =~/^[0-9]/)
The part string =~/^[0-9]/ - does it split the string into single
numbers and check if each of them is a part of the list [0-9] ??
I
Bo Mangor wrote:
But how does it work? if(string =~/^[0-9]/)
The part string =~/^[0-9]/ - does it split the string into single
numbers and check if each of them is a part of the list [0-9] ??
I want to be scour that I have understood the Principe correct.
i would suggest
if($string =~ /^[0-9]/)
checks to see if the string starts with 0. If it doesn't, it checks if the
string starts with 1. If it doesn't, it checks if the string starts with 2,
and so on until the condition is true. If the condition is never true, then
it will do whatever is in your else {} (or
Why should I use PERL with CGI instead of ASP?
Thanks, JP
_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
Root wrote at Thu, 20 Jun 2002 14:04:30 +0200:
ok, found a solution to display the framessets
although it works just fine, I would really appreciate comments etc on how to
optimize the code :)
...
my $path_info = $q-path_info;
if (!$path_info) {
frameset;
exit 0;
}
}
if
It's like asking which, Java or VB?
It's up to you to decide which you know better,
which is better for your application,
which is better for the portablity that you want.
-Original Message-
From: joao silva [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 20, 2002 3:11 PM
To: [EMAIL
Perl works everywhere, ASP works (basically) only on Micro$oft crap.
Perl has mod_perl available for Apache, which will blow away any ASP.
Perl also has things like HTML::Mason which allow you to embed Perl
direclty into your HTML...
Do I sound a bit biased? Heehee, too bad. I dislike
I hate microsoft too, actually I´m trying to convince my boss to use PERL,
so I need strongs arguments to do that. Thanks, JP.
From: Brent Michalski [EMAIL PROTECTED]
To: joao silva [EMAIL PROTECTED]
CC: [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: Re: Please, ASP or PERL?
Date: Thu, 20 Jun
Heh, I probably came off a bit too harsh, Micro$oft really does it all to
themselves...
- Perl is MUCH more widely used than ASP.
- Perl is more maintainable (good management buzzword). I would bet the
farm that there are more *GOOD* Perl programmers than ASP programmers. I
would bet the ASP
We have one.. IIS machine... I forget what it does, but the Sysadmin has
made it an untrusted machine.
I wonder why???.. (all the holes and some how Mirco$oft still floats, maybe
it's a giant turd).
-Original Message-
From: Brent Michalski [mailto:[EMAIL PROTECTED]]
Sent: Thursday,
is there a way I can get Net::SMTP to return errors that it might encounter into a
variable, or something?
so that on the page that pops up after the mail is sent, it can display errors if
there were any. I have read the man page on it and cant figure out a way to do this
any help would be
Thanks to everyone! I guess now I have enough arguments to convince my Boss
to buy me a lot of books from O´Reilly... :)
I´m the only one here who knows anything about Linux and Perl... but I´m
just starting... I hope that I´d become able to help you someday. JP.
From: Bill Odom [EMAIL
Root wrote:
if ($path_info =~/menu/) {
menu;
};
if ($path_info =~/top/) {
top;
};
if ($path_info =~/main/) {
main;
};
validate $path_info to make sure it has an acceptable subroutine name, then
replace the above stuff with:
$path_info();
As another tip, you shouldnt ever print()
Hello,
I am stuck on a bug in my perl cgi program that uses a mysql database.
In executing the following code I am getting a message in the dump that
the
fetch failed --fetch () without execute ()
would anyone be able to see what I am doing wrong or be able to give me
any
idea of how to go about
Good afternoon,
I have small problem here, check out the following:
#!/usr/bin/perl
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
use POSIX 'strftime';
# This works fine on Earthlink's servers using:
print OUT strftime('%A, %B %1d, %Y %I:%M %p',localtime) ,\n;
#returns:
Why should use CGI with Perl instead of ASP???
JP, from Brazil
_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
--
To unsubscribe, e-mail: [EMAIL
Are these -l and -n flags specific to perl 5.6? I am using 5.005 and they
don't work as illustrated:
% perl -e 'while{print if(.45909592993094279021 rand);}' db_mlb_undup.dat
syntax error at -e line 1, near while{
Execution of -e aborted due to compilation errors.
% cat db_mlb_undup.dat | perl
Hi Bob,
On Thursday 20 June 2002 4:38 pm, Bob Showalter wrote:
-Original Message-
From: Gary Stainburn [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 20, 2002 10:57 AM
To: [EMAIL PROTECTED]
Subject: cat binary file
Hi all,
I know this is a FAQ, but I can't seem to
on Thu, 20 Jun 2002 15:15:32 GMT, Drieux wrote:
It just struck me that there are many ways to
make bad coding habits more effective.
Folks EITHER need to get out of the habit of
using a bunch of globals - or become more
effective at the process.
To this latter end I offer this screed.
-Original Message-
From: Gary Stainburn [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 20, 2002 12:11 PM
To: Bob Showalter; [EMAIL PROTECTED]
Subject: Re: cat binary file
...
The point was that I was doing this at the end of a quite
long perl script,
and wanted to do it from
On Thursday 20 June 2002 4:34 pm, David T-G wrote:
Gary --
...and then Gary Stainburn said...
%
% On Thursday 20 June 2002 3:56 pm, Gary Stainburn wrote:
%
...
% What's the best way to cat a binary (file with non-display chars) to
% STDOUT?
...
% open(FIN,$fname.pdf) || dodie(cannot
On Thursday, June 20, 2002, at 09:01 , Jeff 'japhy' Pinyan wrote:
[NOTE: this is a reply to a SATIRE, so don't wig out]
what? you mean it's not a good basis for a 4/1 RFC standard???
On Jun 20, drieux said:
my %globals; # where we hide all our globals
# so we
Timothy Johnson [EMAIL PROTECTED] writes:
sub GetMultiOps{
$ref = $_[0];
while($ARGV[0] !~ /^-\w$/){
$_ = shift @ARGV;
push @{$ref},$_;
}
}
### END #
Which should theoretically give you one array for each option and one array
as a catch-all to use
On Jun 20, Balint, Jess said:
Are these -l and -n flags specific to perl 5.6? I am using 5.005 and they
don't work as illustrated:
The -l and -n flags have been with Perl for quite some time.
% perl -e 'while{print if(.45909592993094279021 rand);}' db_mlb_undup.dat
Uh, you're missing
On Wed, 19 Jun 2002 17:37:44 +0200 (MESZ),
[EMAIL PROTECTED] wrote:
Hello!
I still have problems with my script.I can't really figure out what's
wrong with it.
1 thing for sure, if you use CGI; you don't need the old
ReadParse routine.
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
The GetMultiOpts(\@eArray) passes a reference to an array to the
GetMultiOpts sub so that it knows which array to put the arguments in. Once
it is invoked, it puts any arguments it finds into the array passed to it
until it hits another switch, then it passes control back to the first loop.
Hello all,
I have a hash with the key being the field name and the value being the
order in which the field is to be displayed.like below:
%order = (
DATE = '1',
CPP = '2',
ESN = '3',
BTS = '4'
);
I'm receiving an array that would look something
On Jun 20, Kevin Old said:
I have a hash with the key being the field name and the value being the
order in which the field is to be displayed.like below:
%order = (
DATE = '1',
CPP = '2',
ESN = '3',
BTS = '4'
);
I'm receiving an array that would look
Hello all,
I have a hash with the key being the field name and the value being the
order in which the field is to be displayed.like below:
%order = (
DATE = '1',
CPP = '2',
ESN = '3',
BTS = '4'
);
I'm receiving an array that would look something
Hi all, I am now making a bookshelf program with perl.
At this very beginning, I do wonder if the below script
can be simpler or not...
sub getQuery
{my $queryStr = @_; my %ret;
if (! $queryStr) { $ret{user} = 'system' ; $ret{book} = 'index' ;
$ret{page} = 0 }
else
At 02:41 PM 6/20/02 +0200, Martin A. Hansen wrote:
i will elaborate the question:
i have a huge script with many global variables and subroutines.
several variable names are reused, but lexically scoped to subroutines
and everything works fine.
but if you forget (bugs do occur!) to declare a
At 09:01 AM 6/20/02 +0200, Damir Horvat wrote:
Hi!
I've been trying to keep this thingie going with this sub, but it dies on
me every now and then ...
or, does someone have a full-featured daemon code|sub?
% perldoc -q daemon
Found in /opt/perl/lib/5.6.1/pod/perlfaq8.pod
How do I fork a
on Thu, 20 Jun 2002 17:27:35 GMT, Connie Chan wrote:
Hi all, I am now making a bookshelf program with perl.
At this very beginning, I do wonder if the below script
can be simpler or not...
[code snipped]
Please don't do this: use CGI.pm instead:
#! perl -w
use strict;
use
Hi there,
I have alredady installed Perl for Solaris 2.6 and
when i try to use the perldoc help i get this error:
rootperldoc -f print
Superuser must not run /usr/local/bin/perldoc without
security audit and taint checks.
How can i fix it ?, what i need to do?
Thanks,
Joe
On Jun 21, Connie Chan said:
sub getQuery {
my $queryStr = @_; my %ret;
You mean:
my ($queryStr) = @_;
or
my $queryStr = shift;
or
my $queryStr = $_[0];
if (! $queryStr) { $ret{user} = 'system' ; $ret{book} = 'index' ; $ret{page} =
0 }
else {
( $ret{user},
On Wednesday, June 19, 2002, at 09:57 , Timothy Johnson wrote:
[..]
But just for
the sake of argument, here's one approach:
On a more serious note, you cats may want to try
perldoc -m Getopt::Std
and walk through what is in the code - since it
has a really nice structure of the form
on Thu, 20 Jun 2002 17:55:00 GMT, Joe Echavarria wrote:
I have alredady installed Perl for Solaris 2.6 and
when i try to use the perldoc help i get this error:
rootperldoc -f print
Superuser must not run /usr/local/bin/perldoc without
security audit and taint checks.
How can i
On Thursday, June 20, 2002, at 10:55 , Joe Echavarria wrote:
Hi there,
I have alredady installed Perl for Solaris 2.6 and
when i try to use the perldoc help i get this error:
rootperldoc -f print
Superuser must not run /usr/local/bin/perldoc without
security audit and taint checks.
--- drieux [EMAIL PROTECTED] wrote:
hence
$globals{var1} - scalar variable
$globals{var1_a}- array variable
$globals{var1_h}- hash variable
$globals{var1_s}- sub variable
$globals{var1_ar} - reference to an array variable
on Thu, 20 Jun 2002 12:41:34 GMT, Martin A. Hansen wrote:
i will elaborate the question:
i have a huge script with many global variables and subroutines.
several variable names are reused, but lexically scoped to
subroutines and everything works fine.
but if you forget (bugs do
On Thursday, June 20, 2002, at 09:01 , Jeff 'japhy' Pinyan wrote:
[NOTE: this is a reply to a SATIRE, so don't wig out]
You should have warned me that there was a clear defect
in the _info model but I have fixed the document
and have demonstration code up
Joao Silva wrote:
Why should use CGI with Perl instead of ASP???
This is sort of like asking why should I eat an apple instead of an orange.
Maybe you dont have an apple, maybe you dont like apples, or maybe you dont
mind apples too much, its just that you are a little more farmiliar
Thanks a lot Japhy, that's exactly the key I want =)
Assign the value at first, replace it when match...
That's very great !!!
Smiley Connie =)
sub getQuery {
my %ret = (
user = 'system',
book = 'index',
page = 0,
);
my $query = shift or return %ret;
Why CGI.pm ? What difference ? =)
- Original Message -
From: Felix Geerinckx [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 21, 2002 1:54 AM
Subject: Re: Would it be simpler ?
on Thu, 20 Jun 2002 17:27:35 GMT, Connie Chan wrote:
Hi all, I am now making a bookshelf
Hi all,
I am going to find some sites for further study Perl... I just found that
I still in the kid level as a Perl programmer... So, would anybody give
me some suggestion on the site for :
1. A list of full pure perl syntax, with usage description and example.
2. Like Javascript.com does (
on Thu, 20 Jun 2002 20:37:32 GMT, Connie Chan wrote:
Why CGI.pm ? What difference ? =)
Because it already contains all logic to parse *all* standards conforming
query-strings, not only your special case.
Soon you may want to work with an html-form instead of appending the query
string to a
On Jun 21, Connie Chan said:
Why CGI.pm ? What difference ? =)
Because CGI does it right. It's easy to do it wrong. Very wrong, very
easily.
--
Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/
on Thu, 20 Jun 2002 20:45:09 GMT, Connie Chan wrote:
I am going to find some sites for further study Perl... I just found
that I still in the kid level as a Perl programmer... So, would
anybody give me some suggestion on the site for :
1. A list of full pure perl syntax, with usage
On Thursday, June 20, 2002, at 01:45 , Connie Chan wrote:
1. A list of full pure perl syntax, with usage description and example.
2. Like Javascript.com does ( A short sample code for a certain purpose.
)
3. Perldoc in Chinese =)
My general Stack of things about Perl Documentation is at:
passed ? :- )
Thanks a lot ! You 've reminded me a question that I ever
wanna ask but ever forget to ask... Is that any Certificate
Exam for qualify on the standard of Perl ?
Smiley Connie =)
- Original Message -
From: Felix Geerinckx [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent:
On Thursday, June 20, 2002, at 02:02 , Nate Brunson wrote:
is there a way I can get Net::SMTP to return errors that it might
encounter into a variable, or something?
so that on the page that pops up after the mail is sent, it can display
errors if there were any. I have read the man page
Hello List,
I am working on my first real Perl program. I am using Active Perl 5.6 on
Windows NT/2000. So far, I am just trying to read a directory of files into
an array, but only those files that are named with 5 or 6 numbers and no
extension, like 12345 or 654321. I've got that part down
Could add the:
grep m/^\d\d\d(\d|\d\d)\d$/ ! -e c:\\prod\\rej . $_ , readdir DIR;
You need to have the directory location because the readdir returns
only the file or directory name read.
Wags ;) ps Did test and put out files only.
-Original Message-
From:
on Thu, 20 Jun 2002 22:03:04 GMT, wrote:
So far, I am just trying to read a directory
of files into an array, but only those files that are named with 5 or
6 numbers and no extension, like 12345 or 654321. I've got that part
down except that I don't know how to keep another directory out
But unless you have done a chdir it will only pass the file name or
directory name and not do what you want.
Wags ;)
-Original Message-
From: Felix Geerinckx [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 20, 2002 15:31
To: [EMAIL PROTECTED]
Subject: Re: filter list of files
on Thu, 20 Jun 2002 22:29:45 GMT, David Wagner wrote:
But unless you have done a chdir it will only pass the file name or
directory name and not do what you want.
You are absolutely right. The line should read:
my @filelist = grep { -f $dir/$_ m/^\d{5,6}$/} readdir DIR;
where
Naser Ali wrote:
Hello Every one,
Hello,
I have attached the samples of the text files from which I am trying to
search and compare certain pattern along with the code. I f you look at the
text file, you will see that from the first sample, there is time value on
line number 2,3,8, and
On Thursday, June 20, 2002, at 03:03 , Auernheimer, Rebecca (CORP,
Consultant) wrote:
[..]
my @filelist = grep { $_ ne -d m/^\d\d\d(\d|\d\d)\d$/ }, readdir DIR;
another close but no cigar you might try
my @filelist = grep { /^\d{5,6}$/ -f $baseDir/$_ } readdir DIR ;
The basic
When I tried:
my @filelist = grep { -f $dir/$_ m/^\d{5,6}$/} readdir DIR;
I got this message:
Global symbol $dir requires explicit package name at
C:\perl\practice\test.pl line 5.
Execution of C:\perl\practice\test.pl aborted due to compilation errors.
I was going to ask about $dir
The mailer was implying that you have
my $dir = 'c:\xxx\xxx';
where this has your directory location
Wags ;)
-Original Message-
From: Auernheimer, Rebecca (CORP, Consultant)
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, June
Hi,
I'm starting work on my own virus scanner.
I tried File::Scan and was getting some sort of error, so
please don't tell me to use it.
I started looking into the virus signature list at
openvirus.org, it looks something like this.
.
VCS=b90f0489feac32c4aae2
Just a list
Gary Stainburn wrote:
On Thursday 20 June 2002 3:56 pm, Gary Stainburn wrote:
open(FIN,$fname.pdf) || dodie(cannot access PDF: $!\n;
print Content-Type: text/html\n\n;
while (sysread FIN, $buffer, 4096) {
print $buffer);
}
close FIN;
This is how to do it.
Todd W.
--
To
Zentara wrote:
Hi,
Hello,
I'm starting work on my own virus scanner.
I tried File::Scan and was getting some sort of error, so
please don't tell me to use it.
I started looking into the virus signature list at
openvirus.org, it looks something like this.
.
browse through www.cpan.org for some modules. I once used a module that
allowed to send mime encoded emails along with attachments. I cant
remember the module name.
On Thu, 20 Jun 2002, Troy May wrote:
Hello,
I need to know if I can send an attachment along with an email. I'm using
Hi,
I need to format a string in a fixed width field. The string may be less than the
length of the format, or may be greater. If less, then it should get padded with
spaces (left or right justified , like using - in sprintf), if greater, then the
string should get truncated to the exact
You can build the format string:
my $myVar = 'ABCD'; #(Left Aligned, padded with spaces)
#$newVar = sprintf(%-10s,$myVar);
#$newVar should have 'ABCD '; # Works
while ( 1 ) {
printf Left or Right: ;
chomp(my $MyInput = STDIN);
last if ( $MyInput =~ /^ex/i );
my $MySign
Try testing for the length of the string and then using the substr()
function to get the part that you want for strings that are longer than
desired.
-Original Message-
From: Shishir K. Singh
To: [EMAIL PROTECTED]
Sent: 6/20/02 10:42 PM
Subject: Formatting
Hi,
I need to format a
70 matches
Mail list logo