At 11:09 01.29.2002 +0530, Deen Hameed wrote:
>I was wondering if people would be kind enough to tag the end of their
>script with __END__ It wouldn't be much trouble for them, and it would
>make me feel oh-so-cool... :)
>
Ok. I'll bite :)
>BEGIN PGP PUBLIC KEY BLOCK-
Version: GnuPG v
* Luinrandir Hernson ([EMAIL PROTECTED]) wrote:
> Below is the code i'm using to filter out non alphanumeric charecters... however
>when i type
> ?!$BOB
> yeilds this:
> -_3f_21_24bob-
What's happening is that your string '?!$BOB' is being URL encoded
(standard CGI procedure) and being tran
This is what I want to do and I dont know where to start:
List files in a directory taking that list with just the filename and no
other information. using that information and populating a listbox.
Can someone help?
Mike
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands
Stuart Clark wrote:
> Hi,
> I am trying to move the decimal point 2 places to the the left.
>
> Eg : To make 4536233 into 45362.33
>
> I tried this
> $total = "4536233";
> $total = sprintf("%0.2f",$total);
> print "$total";
> But I get this
> 4536233.00
>
> Can anyone help please
>
> Reg
There is no way to re-define the variable in perl. The $, @, and % all
have thier own seperate namespaces, and thus the definition
my $in;
my @in;#creates *both* a scalar and array
the best way is to
use warnings;#start of every program!
and it will give you a bit of ugly output to S
To join strings there are several options
for printing your best bet is to send a comma seperated list, as that
will have fewer syscalls (as per llama book advice).
EX:
print "Hello", " World", $scalar_that_will_be_attached_to_end,
@array_that_will_be_flattened;
guys
I am writing a code in perl to fetch the auction numbers from a URL.
I am also fetching some other details in three separate files. I have a main file that
deals with these auction numbers, i have to call these three files into the main file
and print out the details.
eg:
first file :
I think output is lost with system - maybe
my $results = `$cmd`;
Also the print is not needed before the EOF.
At Monday, 28 January 2002, "McCormick, Rob E" wrote:
>Gang,
>
>Using 'df -k' in bash, I can get this to work acceptably:
>
># mail the disk usage for a file system to a recipient 'ui
I'm not too sure if this would be relevant to many others on this list,
but moi, I can pipe your email straight out to perl from pine and see what
the story is about, provided
a) the code starts with the #!
b) ends with the token __END__ (end of script)
I was wondering
Hi Rob,
You don't need to put the system call in backticks. You could just do
$result = `some command`;
to get the output of the command stored as a multiline string in $result.
system() does not store the output of the command, only the exit status of
the command you have called.
I d
On Jan 29, Mayank said:
>Shouldn't PERL support the array index nomenclature as in shell
>scripting in place of C's syntax. After all it's more intutuive.
I'm afraid I don't know what you mean. Are you asking why Perl arrays do
not start at 1?
There is precedence for 0-based arrays, based on t
Thanx a lot. it worked except for the fact
i used @a=split(/\|/,$a) as @a=split('|',$a) was not
working...(Similarly for @b)
and used $a[10] cmp $b[10] as the file needs to be sorted on the basis
of 11th field.
Shouldn't PERL support the array index nomenclature as in shell
scripting in plac
Rob E McCormick wrote:
>
> Thanks for the prompt repliesmy apologies, but I'm not grasping the
> quoting problem(s) or another problem.?
>
> I revised the code to use an @array v. $scalar. I also noticed I left out
> the -odq option in the perldoc example, so inserted it (as docs indica
CommerceSQL uses Perl and needs https, secure server. I already asked this on
their list with no reply. I don't know the first thing about secure servers.
Can somebody point me in the general direction of how to set one up on NT4?
Thx,
/g
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For add
Frank McCollum wrote:
>
> I asked this earlier but got no response, so all that is different is the
> subject. Surely, there is some one in this group who can answer this
> seemingly simple problem! -Frank
I responded to your earlier request on 14 Jan. 2002, Message-ID:
<[EMAIL PROTECTED]>.
"Martin A. Hansen" wrote:
>
> hi there
Hello,
> im trying to call a subroutine and get it to return some hash table values. however,
>i have two problems.
>
> 1. it does not work. theres something wrong with my foreach sentence,
> but i cant see what it is. however, the commented foreach
Below is the code i'm using to filter out non alphanumeric charecters... however when
i type
?!$BOB
yeilds this:
-_3f_21_24bob-
The ?!$ should be stripped away and come back empty, not
_3f_21_24
ANY ideas as to what I'm doing wrong???
I'm asking for an email address.
my $eaddress = "";
rea
I absolute love this black book. Its a must for the Perl library. Library
meaning all the O'reilly books. But definitely a must have imo.
- Jim
At 14:56 01.28.2002 -0800, Matthew Lyon wrote:
>not blasphemy.
>
>/me <-- biologist.
>
>:)
>
>mL
>
>On Mon, 28 Jan 2002, Brett W. McCoy wrote:
>
> >
--- Leon <[EMAIL PROTECTED]> wrote:
> Try this;
> my $total = "4536233";
> $total =~s/(.+)(\d{2})/$1.$2/;
> print $total;
Ooh... I'd be careful of a regex like that.
$ perl -e '
> $foo = "I told you 100 times not to do that :)";
> $foo =~ s/(.+)(\d{2})/$1.$2/;
> print $foo'
I told you 1.00 time
Another solution would be to replace the glob() statement with a readdir and
then compare the filenames like this:
my @files;
my @matches;
chdir "L:/Desks/Agency Passthru Trading/Reports/" || die "Could not change
to directory!";
opendir(DIR,".") || die "Could not open directory for reading!";
Try this;
my $total = "4536233";
$total =~s/(.+)(\d{2})/$1.$2/;
print $total;
- Original Message -
From: "Stuart Clark" <[EMAIL PROTECTED]>
To: "Perl List" <[EMAIL PROTECTED]>
Sent: Sunday, January 27, 2002 5:56 PM
Subject: decimal point
> Hi,
> I am trying to move the decimal point 2
On Mon, 28 Jan 2002 15:02:31 -0800, David Palomino wrote:
> I am trying to parse lpstat -s output from HPUX. There are two lines
> per "record". It looks like this:
Playing with the $/ might help you a bit here
#!/usr/bin/perl -w
use strict;
$/ = 'device for';
my $header = ;
while (){
As far as the Windows Find tool goes (which I know wasn't your original
question)... If the file name is in quotes, i.e. "Mortgage Market*" (WITH
the quotes), it performs as expected.
As far as perl goes...
Try replacing the spaces with questions marks. Also, FYI: glob will return
an array of n
Thanks for the prompt repliesmy apologies, but I'm not grasping the
quoting problem(s) or another problem.?
I revised the code to use an @array v. $scalar. I also noticed I left out
the -odq option in the perldoc example, so inserted it (as docs indicate,
controls queuing/delay )
Update
On Jan 28, Naveen Parmar said:
>How do I have Perl script accept input from a file?
Two ways that come to mind:
while (<>) {
# this reads from the command-line arguments as filenames
# or from STDIN if there are no arguments
}
or
open FILE, "< $ARGV[0]" # uses the first arg as a
Hello,
I am trying to parse lpstat -s output from HPUX. There are two lines per
"record". It looks like this:
-- begin sample raw data -
no system default destination
device for ms331x_lzr: /dev/null
remote to: ms331x-lzr on spooler1
device for df447x_lzr: /dev/null
remote
Hello,
How do I have Perl script accept input from a file?
TIA,
- NP
_
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
my @results = `/usr/bin/df -k`; # now stores all the lines of df -k
# backticks seem to be working OK?
[snip]
#everything here is in double quotes until you see another EOF
print SENDMAIL <
To:
Subject: host disk usage
host disk usage
@results
EOF
[snip]
-Original Message-
From: McC
Gang,
Using 'df -k' in bash, I can get this to work acceptably:
# mail the disk usage for a file system to a recipient 'uid'
df -k /data/wrc |mailx -s 'host disk usage' [EMAIL PROTECTED]
I'd like to use perl to surround the output of df -k with a simple text
message. I used perldoc -q mail to
not blasphemy.
/me <-- biologist.
:)
mL
On Mon, 28 Jan 2002, Brett W. McCoy wrote:
> On Mon, 28 Jan 2002, Matthew Lyon wrote:
>
> > it's good book if you are not a programmer by trade and think the
> > camel book is boring. if you buy this definately also pick up 'perl
> > cookbook' by oriley
the cookbook is the most amazing thing ever.
On Mon, 28 Jan 2002, Nikola Janceski wrote:
> I don't think the Black Book with contribute anymore.. the Cookbook takes
> the cake.
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 28, 2002 2:
On Mon, 28 Jan 2002, Matthew Lyon wrote:
> it's good book if you are not a programmer by trade and think the
> camel book is boring. if you buy this definately also pick up 'perl
> cookbook' by oriley and you'll be set.
The Camel Book boring? Blasphemy! :-)
-- Brett
it's good book if you are not a programmer by trade and think the
camel book is boring. if you buy this definately also pick up 'perl
cookbook' by oriley and you'll be set.
On Mon, 28 Jan 2002 [EMAIL PROTECTED] wrote:
> What do everyone think about this book?
>
> Perl
> Second Edition
> Black Bo
The only solution (and it's not a good one) is to replace all the spaces
with a ? (question mark).
-Original Message-
From: McCollum, Frank [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 4:10 PM
To: [EMAIL PROTECTED]
Subject: Matching for filenames with spaces in them?
I as
I asked this earlier but got no response, so all that is different is the
subject. Surely, there is some one in this group who can answer this
seemingly simple problem! -Frank
> I am guessing that the spaces are the problem, because if I put the same
> string in the Windows Find tool, I get t
On Mon, Jan 28, 2002 at 02:35:10PM -0500, Nikola Janceski wrote:
:Can the indented code below be written better (fewer lines or easier/better
:algorithm)?
Yep.
:srand(time ^ $$); # i don't care about the seed
In recent versions of Perl (5.005* and up, I think), you don't need to
call srand().
Can the indented code below be written better (fewer lines or easier/better
algorithm)?
srand(time ^ $$); # i don't care about the seed
$words = "Removes a random letter";
$randnum = int( rand( length($words) ) ); # always an interger number one
less than the length
# this was the only
On Mon, Jan 28, 2002 at 08:21:44PM +0100, anthony wrote:
:
:does anyone know if Javascript can interact with dbi?
:not mysql
I think I can manage to tun this into a Perl related question. :-)
There is a module called WDDX, actually, it's a protocol. You can use
it to turn Perl data structures
Hi,
does anyone know if Javascript can interact with dbi?
not mysql
Anthony
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I don't think the Black Book with contribute anymore.. the Cookbook takes
the cake.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 2:04 PM
To: [EMAIL PROTECTED]
Subject: Perl, Black book
I forgot to mention that I have both the "Perl
Hi all,
Working on a CGI script that will allow me to take entries from text
fields and pull down menus and generate a permanent html page on my server
based on this info. I have the form script working, and a template for
the HTML document I want to create.
Can anyone point me toward where to
> use IO::Socket;
> $port=21;
>
> $sock = IO::Socket::INET->new(PeerAddr =>'localhost',
> PeerPort =>
> $port,
> Proto => 'tcp') ;
> die &inetdconf unless ($sock);
>
>
> my $cmd4=" net stop inetd && net start inetd
I forgot to mention that I have both the "Perl Cookbook" which was given to
me personally by Tom Christainsen
and the Lama book.
__
William Ampeh (x3939)
Federal Reserve Board
- Forwarded by William Ampeh/BOARD/FRS on 01/28/02 02:02 PM -
I have this book at work, it's good for lots of examples, and learning by
example, but the make sure you have the O'Reilly 'Programming Perl' book
first. The Big Black Book has lots to teach, but hard to read straight
through unlike the O'Reilly book.
And for javascript you should check out http:
What do everyone think about this book?
Perl
Second Edition
Black Book
By Steven Holzner?
Price: $59.99 (41.99 @Amazon)
I was at Borders last night
PS: Of course the list has been a valuable resource, but I am looking for
a very good
book on my shelf.
Also, what is a very good book on Java-s
> I need a clean way to detect if a floppy is in the floppy
> drive, prior to accessing the drive to write a file.
>
> Is there a clean method, in perl, to do this?
Err... why not do the following:
while (not open(FILE, ">m")) { prompt("Insert Disk") }
The *** BEST *** way to do this sort of t
On Mon, Jan 28, 2002 at 06:13:26PM +0100, Martin A. Hansen wrote:
:hi
:
:if i have a file called table.hash looking like this:
:
[ snipped hash data ]
:
:how do i access the hashtable with a key and return the appropriate
:value?
Hey martin, in order to use the file that you showed us, use the
fo
I need a clean way to detect if a floppy is in the floppy drive, prior to
accessing the drive to write
a file.
Is there a clean method, in perl, to do this?
In VB, I can make an API call (Can't remember what it is off the top of my
head) that
will basically look at the drive and detect if I need
hi
if i have a file called table.hash looking like this:
{
'HEADLINE' => 'Carcinoma in Situ',
'SUBHEADLINE' =>
'
the precursor cell for testicular germ cell cancer in adolescents and young adults
',
'BODYTEXT' =>
'
This site provides information on research, diagnosis and management
of early
> "Connie" == Connie Chan <[EMAIL PROTECTED]> writes:
Connie> First, LHS is "left hand side", and it is the *key* also. the meaning of
Connie> this is
Connie> %foo = (mine name=> Connie) is also a valid declaration,
No. Only a single bareword (\w+) or a single bareword with a single
minus
THANKS A LOT!!!
"Malunas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a log file in text format. I need to delete the first line so I
could
> put the rest in MySQL database. How do I delete only the first line of
this
> text file?
> Thanks for your he
if you also run under -w or do a 'use warnings' it will give you a warning if
you're doing something like that.
consider this:
use strict;
use warnings;
my $i = 'foo';
my $i = 'bar';
will print to stderr with:
"my" variable $i masks earlier declaration in same scope at C:\tmp\t.pl line 6.
On Mon, 28 Jan 2002, Martin A. Hansen wrote:
> $extract = qw (en tre ni);
>
> # foreach $number (qw ) {
> foreach $number ($extract) {
ummm... shouldn't this be
forwach $number (@extract) { ?
^ note the @
you're calling the for loop with a scalar.
John,
Thanks for your input. However, what I was expecting was to have variables
that are scoped properly without being accidentally redefined within the
same scope. Using constants would prevent the "redefining" problem,
nonetheless they would not allow me to alter the values either!
In VBScrip
You could use a constant instead.
-- code --
use strict;
use constant INDEX => 5; # I'm assuming $i refers to an index. Use more
descriptive variable names...
print ("Value of index" . INDEX . "\n");
INDEX = 6;
-- end code --
Run that and you will get the following error.
Can't modify const
Friends,
When we use strict pragma, is there a way to "prevent" redefining a
variable?
use strict;
my ($i) = 5;# $i defined
print ("Val of i = $i");
my ($i) = 6;# $i redefined?Could this be tagged as an
error?
print ("Val of i = $i");
Thanks,
Rex
On Jan 28, Mayank said:
>How can i have an equivalent of following UNIX command in PERL?
>sort -t "|" -k 11,11 $file1 > $file2
>Which means sort file "$file1" on the basis of 11th field with "|" as
>the delimiter
You can do it the "long" way:
my @orig;
open FILE, "< $file1" or die "can't re
On Mon, 21 Jan 2002, Michael Pratt wrote:
> I cant seem to get this to work is there something Im missing?
>
> $logfile = '/logs/ipaccess.log';
> $date = scalar localtime;
>
> open(IPLOG, ">>$logfile"
Check your quotes - do you know the difference between single- and
double-quotes?
Are you usi
There is a new C++ beginner's list and also some newsgroups at
http://www.beginthread.com.
-Original Message-
From: Deen Hameed
To: [EMAIL PROTECTED]
Sent: 1/26/02 10:34 PM
Subject: OT: C++ Mailing List
I realise this is OT, but I'm a newbie to programming in general and I
was
wond
The sort function takes an optional subroutine which is where you can add
you logic for the sort. The subroutine is passed two items from the list at
a time and needs to return -1 is the first item comes first, 1 if the second
item comes first, or 0 if the values are equal. The vales are passed
when I install the GD module, exactly, when I execute
the cmd of "perl makefile.pl", it says that I am in
short of the following lib. I know I should add push
sentence in the makefile.pl, and how can I find these
library if they don't exist in my computer? The
warning is as below:
"
D:\Perl\packag
> "Dhiraj P Nilange" <[EMAIL PROTECTED]> said:
> > chdir "...";
This should be ".." and not "...". Otherwise seems to work.
--
Smoot Carl-Mitchell
Senior Unix Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 609 8839
work: +1 602 643 4006
--
To unsubscribe, e-mail:
yun yun [[EMAIL PROTECTED]] quoth:
*>I've downloaded some modules from cpan, but how I
*>should install them so that I could use them in my
*>perl program?
http://www.cpan.org/misc/cpan-faq.html
e.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This is what happened. The Perl process did change dir, but remember when
it ends
it goes with all its baggage, so the parent process does not have anything
to do
with the chdir.
Try this:
#!/opt/local/bin/perl
$dirname = "./TEST";
chdir("$dirname"); #this sets current directory to ./TEST
Hi all
i'm a newbie.so this might appear to be an easy one!
How can i have an equivalent of following UNIX command in PERL?
sort -t "|" -k 11,11 $file1 > $file2
Which means sort file "$file1" on the basis of 11th field with "|" as
the delimiter
Thanks in advance
Regards
Mayank
--
To unsu
Johnson, Shaunn [[EMAIL PROTECTED]] quoth:
*>My management is thinking about signing up the department
*>for Perl classes (maybe introduction to Perl).
*>
*>Is there a list / company that has such a site? I went to
*>Perl.org and did a search and didn't see much in the
*>way of Perl classes and c
A very common way is to do this (on Unix):
1) unzip and extract the tarfile
2) perl Makefile.PL
3) make
4) make test
if everything turns out ok...
5) 'make install'
Alternatively, you can use the CPAN module:
perl -MCPAN -eshell
then, after you configure it (if it's your first time using
hi, I have this code:
use IO::Socket;
$port=21;
$sock = IO::Socket::INET->new(PeerAddr =>'localhost',
PeerPort => $port,
Proto => 'tcp') ;
die &inetdconf unless ($sock);
my $cmd4=" net stop inetd && net start inet
I recently used XML::Simple for something very similar. You just tell it to read
your xml file and it'll parse it up and create a handy data structure to work with.
Use it with Data::Dumper if you want to see how it handles your xml:
#!/usr/local/bin/perl -w
use Data::Dumper;
From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]>
> Prototypes can be avoided by prepending a & to the function call --
> that's just the way it goes. That way, you can say:
>
> $avg = &average([]);
>
> if you really wanted to. I don't condone this, personally.
> Now, what a
> I am guessing that the spaces are the problem, because if I put the same
> string in the Windows Find tool, I get the same unexpected results. I
> have this code below and expect to get the file named... "Mortgage Market
> Review Package (25 Jan 2002).pdf", but instead I get a single word,
> "
Hello everyone!
It's my first expirience with XML.
I have simple XML document like this
And I need to produce something like this
.. something like header here ..
root is 'site'
Howdy:
My management is thinking about signing up the department
for Perl classes (maybe introduction to Perl).
Is there a list / company that has such a site? I went to
Perl.org and did a search and didn't see much in the
way of Perl classes and criteria.
Any suggestions?
Thanks!
-X
hi there
im trying to call a subroutine and get it to return some hash table values. however, i
have two problems.
1. it does not work. theres something wrong with my foreach sentence,
but i cant see what it is. however, the commented foreach sentence
do work?
2. the @return_array n
I've downloaded some modules from cpan, but how I
should install them so that I could use them in my
perl program?
_
Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn
ÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡¡ª¡ª
ÑÅ»¢È«ÐÂÁÄÌìÊÒ! http:
Greetings and salutations to you all,
Trying to get POP3 to work. I have a program that should get all the headers and
subjects from the pop3 server, but it displays none, and if I put a check in to see
how many messages there are it says there are none, despite me having sent myself some
t
Got it sorted!
I had already put the \n on the line before printing with no success, but
I followed chomp with a chop, and it worked a treat!
I think that chomp was removing the Carriage return but not line feed (maybe
the other way round), the chop just removes the last character (which after
c
Stuart Clark wrote:
>
> Hi,
Hello,
> I am trying to move the decimal point 2 places to the the left.
>
> Eg : To make 4536233 into 45362.33
>
> I tried this
> $total = "4536233";
> $total = sprintf("%0.2f",$total);
> print "$total";
> But I get this
> 4536233.00
>
> Can anyone help please
$
did i say 10? i meant 100
-Original Message-
From: Darren Simpson
Sent: 28 January 2002 08:48
To: 'Stuart Clark'; Perl List
Subject: RE: decimal point
i would try dividing the number by 10
-Original Message-
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: 28 January 2002 0
Dear Stuart,
The Sprintf function may not be able to change the value of the scalar
variable $total...its only used to format the value for display...
so dividing by 100 seems to be the only way out...or you could use
string functions to fetch the substrings and concatenate them with
decimal
i would try dividing the number by 10
-Original Message-
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: 28 January 2002 01:57
To: Perl List
Subject: decimal point
Hi,
I am trying to move the decimal point 2 places to the the left.
Eg : To make 4536233 into 45362.33
I tried this
Hi,
I am trying to move the decimal point 2 places to the the left.
Eg : To make 4536233 into 45362.33
I tried this
$total = "4536233";
$total = sprintf("%0.2f",$total);
print "$total";
But I get this
4536233.00
Can anyone help please
Regards
Stuart Clark
82 matches
Mail list logo