Re: XML Header
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Need a little help I am using #!/usr/bin/perl -w use CGI qw/:cgi-lib/; print PrintHeader(); This gives a result of Content-Type: text/html I need it to be Content-Type: text/xml How do I do that. Jason see http://stein.cshl.org/WWW/CGI/cgi_docs.html#html and the subsection on -dtd and -head a *seriously* verbose description of the proper doctype header for XML is at http://www.w3.org/XML/1998/06/xmlspec.dtd and you *should* use it. for example !DOCTYPE spec PUBLIC -//W3C//DTD Specification V2.1//EN http://www.w3.org/XML/1998/06/xmlspec-v21.dtd; CGI.pm emits an XHTML header by default, unless you specify -no_xhtml in the invocation of use CGI qw/ :blah -no_xhtml /; -- Scott R. Godin| e-mail : [EMAIL PROTECTED] Laughing Dragon Services |web : http://www.webdragon.net/ It is not necessary to cc: me via e-mail unless you mean to speak off-group. I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
file permissions
Hi, I'm trying to copy a file to another preserving the file permissions (i'm using NT 4.0). I'm using File::Copy; But when i copy a file to another the new file do not get the same permissions as the old one... I'm also trying to use syscopy ($file1, $file2); but i got no success... Thanks in advance, Wagner Garcia Campagner -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cookie check problem
I hate to ask but why isnt this thing sending me to the frames page if I already have the cookie? if ($ENV{'QUERY_STRING'} eq ) { Get_Cookie; if (exists($cookie{'SessionID'})) { MainFrames_Page; } else { login_page; } } Regards, Andre` C. Technical Support ԿԬ - Visit our support manual at http://supportmanual.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Quick question
Andre- How about simply multiplying by 10,100 or what ever you need then dropping the remaining decimal I.E. Int(100*rand(18)); Andre` Niel Cameron wrote: Hi, Anyone know how to get a whole random number in perl? rand(18) always gives decimals I need just like 12 or 7 anyone know? Regards, Andre` C. Technical Support ԿԬ - Visit our support manual at http://supportmanual.com/ -- Mark Murphy [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
shadow file
hi. I find one source code about crypt function. I put it in my source code,but it gives this error to me : useradd: unable to lock password file . i want to add user from web with useradd function. would you help me ?? thx alot. I am waiting_ ___ Nafiseh Saberi
friend
hi all. I need some yahoo id from yours that work online. for associate in problems better. the time in here is 12.am. my id is [EMAIL PROTECTED] I am online from 9 a.m till 15.p.m thx alot. Nafiseh Saberi
Re: shadow file
Hello nafiseh, Thursday, November 22, 2001, nafiseh saberi [EMAIL PROTECTED] wrote: ns hi. ns I find one source code about crypt function. ns I put it in my source code,but ns it gives this error to me : ns useradd: unable to lock password file . ns i want to add user from web in shadow file, ns with useradd function. ns would you help me ?? your script (mostly, http daemon) haven't sufficient privileges to create user. this question is very far from perl, so consult your system/web administrator. If your http daemon is apache, you can read http://httpd.apache.org/docs-2.0/suexec.html too. Best wishes, Maximmailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Counting White Spaces in perl
I am trying to count the no. of blanks that appear and then break out of the loop when all arrays' last elements are blanks/spaces. I think sprintf will do it but I can't figure it out: printf DGSUM++\n; for $sr(1 ..9) { $one = ; if($place1[$sr] eq ){ printf DGSUM | %d | N/A |,$sr; $one = mt; }else{ printf DGSUM | %d | %9s | ,$sr, $cwdp[$sr]; } if($place2[$sr] ne ){ if($one eq mt){ printf DGSUM %9s |, $place2[$sr]; }else{ printf DGSUM %9s |, $place2[$sr]; #data in so print to screen } }else{ printf DGSUM N/A |; } if($place3[$sr] eq ){ $one = mt; printf DGSUMN/A |; }else{ printf DGSUM %9s |, $place3[$sr]; } if($place4[$sr] ne ){ printf DGSUM %9s |\n,$place4[$sr]; }else{ if($one ne mt){ printf DGSUM %9s |\n, $place4[$sr]; }else{ printf DGSUMN/A |\n; #printf DGSUM place4=%s\n,$place4[$sr++]; } #printf DGSUM place4=%s\n,$place4[$sr++]; #if (($place1[$sr++] eq ) ($place2[$sr++] eq ) ($place3[$sr++] eq ) ($place4[$sr++] eq )){ #break;} } each $place1[$sr] , $place2[$sr] , $place3[$sr], $place4[$sr] is a dial-in gateway. I go through each gateway, pluck out its call stats and print them out. If there's no gateway, I print N/A (that is there are 3 gw's per site except for the last one that has 5 gw's, therefore the other 3 gateway's for their row 4 +5 have N/A beside them here's the output: ++ |Daily Dial Gateway Call Totals | |for 14 11 2001 | ++ ++ | DG # | Place1 | Place2 |Place3 | Place4 | ++ | 1 | 83018 | 66848 | 87005 | 62313 | | 2 | 76762 | 66734 | 87000 | 62260 | | 3 | 59572 | 57035 | 74555 | 53402 | | 4 | N/A |N/A | N/A | 0 | | 5 | N/A |N/A | N/A | 0 | | 6 | N/A |N/A | N/A | N/A | ++ |Total |219352 |190617 |248560 |177975 | ++ ++ | Grand Total | 836504 | ++ I am trying to prevent the last row of N/A from appearing as there is no gateway 6 therefore the rows should stop at row 5 and row 6 should not appear. I have been at this for a while and can't work out how to do this with sprintf any ideas ? thanks in advance Harry -- ___ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup 1 cent a minute calls anywhere in the U.S.! http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJurl=http://www.getpennytalk.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
wardialing ...
Gents, is there anybody who knows of any piece of perl code for the use of trad. wardialing ? regards, Henrik Falkenthros [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getting ip address
#! /usr/bin/perl use CGI; $q = new CGI; $ip = $q-remote_host; if ( $ip eq 'w.x.y.z') { # code } else { # code } -- Djoko Priyono System Programmer PT Dyviacom Intrabumi Tbk. Jakarta - Indonesia On Wednesday 21 November 2001 08:02 pm, Rahul Garg wrote: Hi everybody, The problem goes like this : from html i am calling a perl script. in that perl script what i want is : if (the request is comping from ip adress==w.x.y.z) { #code } else { #code } what should i do to know from which ip address the request is coming in perl... any suggestions..refrences..sample perl script for this will be of immense help. Thanks Rahul -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: -onChange
On Wednesday 21 November 2001 01:48 am, Jenda Krynicky wrote: From: Jeff 'japhy' Pinyan [EMAIL PROTECTED] On Nov 19, Jerry Preston said: Trying to learn how to -onChange, where can I find some good doc and examples? If you're trying to learn about CGI.pm that support Javascript, this is a good site : http://stein.cshl.org/WWW/software/CGI/cgi_docs.html - Djoko Priyono System Programmer PT Dyviacom Intrabumi Tbk. www.dnet.net.id Jakarta - Indonesia You're barking up the wrong tree. onChange is a javascript event. Well ... such a handler may exist in other event based systems. Tk comes to mind (though I did not find onChange there). Maybe Jerry meant wxPerl, gTk or something. Also notice the dash : -onChange. That looks Perlish, not JavaScriptish. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: extracting *just* matched text
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Waspcatcher) wrote: hi, how does one extract *just* the matched text in a regular expression, e.g. my $text = Hello 1234, come in; if ($text =~ /\d{4,4}/) { #grab just the 4 digit number } thanks if ( $text =~ /(\d{4,4})/ ) { print captured $1\n; } parens around what you want to capture, and each paren group is from left to right, stuffed in $1, $2, $3, etc. see perldoc perlre for examples -- Scott R. Godin| e-mail : [EMAIL PROTECTED] Laughing Dragon Services |web : http://www.webdragon.net/ It is not necessary to cc: me via e-mail unless you mean to speak off-group. I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name of current sub?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Chuck Tomasi) wrote: I find myself writing this sort of thing a lot: print STDERR program.pl: subname(): debug statement\n; I know $0 can be used for programname.pl (except it returns the full path to the program), is there some cool variable to get my hands on the name of the current sub? --Chuck perldoc -f caller the croak and confess portions of the Carp module are also useful. perldoc Carp -- Scott R. Godin| e-mail : [EMAIL PROTECTED] Laughing Dragon Services |web : http://www.webdragon.net/ It is not necessary to cc: me via e-mail unless you mean to speak off-group. I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reading and writing to a text file
Hi, Two things. Firstly, I would like to know if it is possible to write in a program or script in perl to read a set of two numbers seperated by a comma, I have exported to a text file and the put the numbers in another table as arguements. Secondly, can you give me directions if yes to above, I have written a script that will take the numbers, and put then in another text file but I am stuck with geting perl to treat them as variables for the next text file. shown below #! usr/bin/perl -w open(PRE, d:\mac.txt) || die cannot open mac.txt for reading: $!; open(POST, info.txt) || die cannot create info_sbu.txt: $!; while (PRE) {# read a line from mac.txt into $_ print POST $_; # print that line to info.txt } #Close(PRE) || die can't close mac.txt: $! ; #close(POST) || die can't close info_sbu.txt: $! ; any suggestions or nudge in the right direction is greatly appreciated ___ Build your own website in minutes and for free at http://ca.geocities.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:slash issue on a regex
Hi, I have this: $buf=~(/d:/dhs3mgr/e1401/dhs3linux/fr/cpiofile/) but it didn't work.How can i do to escape the /. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NET::TELNET
Try to use the logging features of this module, which will almost certainly help. It'll create a nice text file for each side of the telnet session that will allow you to see what's going on. If you're running SSH on the box (probably a better idea anyhow), try the Net::SSH::Perl module, which I found to be fantastic. Easier and smarter than Net::Telnet, plus it's SSH. Hope this helps. Matt __ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SALT in CRYPT!!
On Thu, 2001-11-22 at 06:38, nafiseh saberi wrote: how does crypt work in adduser function ?? and... how does it use from salt... I seem to recall our very own Japhy writing a good tutorial on the use of crypt(). It's at: http://www.crusoe.net/~jeffp/docs/crypt Hope this helps, - ~C. -- Chris Ball E-mail: [EMAIL PROTECTED] Web Programmer Web : www.fastsearch.com Fast Web Media Ltd Mobile: +44 (0)7769 903 770 12th Floor Sunlight House, Quay Street, Manchester M3 3JZ, UK. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
checking if a file exists
How would I check if a certain file exists in a certain directory? I'm already using File::Find to process a bunch of mp3's, and before I move/copy them to a different folder, I want to check if the file already exists. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checking if a file exists
Thursday, November 22, 2001, 2:19:16 PM, [EMAIL PROTECTED] wrote: GFFC How would I check if a certain file exists in a certain directory? GFFC I'm already using File::Find to process a bunch of mp3's, and before I GFFC move/copy them to a different folder, I want to check if the file already GFFC exists. you can use the -e operator... $file = '/etc/passwd'; if (-e $file) { # the passwd file exists } perldoc -f -X http://www.perldoc.com/perl5.6.1/pod/func/X.html -- Best regards, Danielmailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checking if a file exists
if (-e $file) do something [EMAIL PROTECTED] wrote: How would I check if a certain file exists in a certain directory? I'm already using File::Find to process a bunch of mp3's, and before I move/copy them to a different folder, I want to check if the file already exists. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Etienne Marcotte Specifications Management - Quality Control Imperial Tobacco Ltd. - Montreal (Qc) Canada 514.932.6161 x.4001 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:slash issue on a regex
On Nov 22, Jorge Goncalvez said: $buf=~(/d:/dhs3mgr/e1401/dhs3linux/fr/cpiofile/) but it didn't work.How can i do to escape the /. Well, escaping is done with \, but if you do that, you'll end up having leaning toothpick syndrome: $buf =~ /d:\/dhs3mgr\/e1401\/dhs3linux\/fr\/cpiofile/; That is gross. Use a different m// delimiter: $buf =~ m{d:/dhs3mgr/e1401/dhs3linux/fr/cpiofile}; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: shadow file
yeah, you´re right maxim. I solved this prob with two separate progs: the cgi gives the user-data to a deamon (running as root) using a persistent hash. hope this helps -- peter grotz rehberger architekten schertlinstr 23 86 159 augsburg tel 0821 25980-29 fax 0821 25980-20 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
2 perl installs HELP
While troubleshooting a problem I have realized that I have 2 perl installations. I would like to start over with my perl installation and just use tarballs from now on. The server is hot so I need to be careful. I am running RedHat 7.0 The RPM installation is in /usr/lib/perl5version 5.6.0 The tarball install is in /usr/local/bin/perl5 version 5.6.1 How can I get rid of everything including the man pages and start over. If I run perl -V I get the tarball install but If I try to use a module in the tarball install in my httpd.conf it can't find it because its looking in the rpm install. I got a real mess here. Can someone help guide me down the easiest/best path to rectify this problem. Thanks Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
that ':: thing
BDY.RTF Description: RTF file -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Weekly list FAQ posting
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to [EMAIL PROTECTED] You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] This is a high traffic list (100+ messages per day), so please subscribe in the way which is best for you. 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a week, and will be available online in the archives, and at http://learn.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who owns this list? Who do I complain to? Casey West owns the beginners list. You can contact him at [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl beginners. 1.11 - When was this FAQ last updated? Sept 07, 2001 2 - Questions about the 'beginners' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Monkeys * Monkeys solicitating homework on non-Perl related SPAM. 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl, then it is allowed. You can ask CGI, networking, syntax, style, etc... types of questions. If your question has nothing at all to do with Perl, it will likely be ignored. If it has anything to do with Perl, it will likely be answered. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) Please do not quote the documentation unless you have something to add to it. It is better to direct someone to the documentation so they hopefully will read documentation above and beyond that which answers their question. It also helps teach them how to use the documentation. 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: `perldoc perldoc' At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 2.8 Is this a high traffic list? YES! You have been warned! If you don't want to get ~100 emails per day from this list,
Re: that ':: thing
From: [EMAIL PROTECTED] I'm a super beginner...what exactly is happening when '::' is being used. Is this related to a 'use this;' statement? Dumbguy Well ... it's hard to say what's happening. Here $main::x = 5; the :: separates the name of package (a separate namespace) from the name of the variable. Here use Foo::Bar; it separated the parts of the module name and will be converted to / when looking up the module. That is perl will loop through the directories in @INC array and look for subdirectory Foo containing file Bar.pm. It will then load and compile the code and (if it exists) execute function Foo::Bar::import(). Here package Foo::Bar; it's not doing anything. It's just a part of the name of the package. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Counting White Spaces in perl
I'll take a whack at this: At 08:19 11.22.2001 +0800, Harry Varvarigos wrote: I am trying to count the no. of blanks that appear and then break out of the loop when all arrays' last elements are blanks/spaces. I think sprintf will do it but I can't figure it out: printf DGSUM++\n; for $sr(1 ..9) { $one = ; if($place1[$sr] eq ){ printf DGSUM | %d | N/A |,$sr; $one = mt; }else{ printf DGSUM | %d | %9s | ,$sr, $cwdp[$sr]; } if($place2[$sr] ne ){ if($one eq mt){ printf DGSUM %9s |, $place2[$sr]; }else{ printf DGSUM %9s |, $place2[$sr]; #data in so print to screen } }else{ printf DGSUM N/A |; } if($place3[$sr] eq ){ $one = mt; printf DGSUMN/A |; }else{ printf DGSUM %9s |, $place3[$sr]; } if($place4[$sr] ne ){ printf DGSUM %9s |\n,$place4[$sr]; }else{ if($one ne mt){ printf DGSUM %9s |\n, $place4[$sr]; }else{ printf DGSUMN/A |\n; #printf DGSUM place4=%s\n,$place4[$sr++]; } #printf DGSUM place4=%s\n,$place4[$sr++]; #if (($place1[$sr++] eq ) ($place2[$sr++] eq ) ($place3[$sr++] eq ) ($place4[$sr++] eq )){ #break;} I see that you tried to use simple if-then-else to solve your problem. I believe that that was failing because you were doing an exact match of $place[$sr] to be equal to (nothing) but you've already explained above that actually, you are looking for white space and nothing != white space. Ok. So, I will hit this at three angles. 1. Lets consider hitting this from the angle you tried above? I would change the condition like so: if ( $place[$sr++] =~ /\s|\s+/ ) { ... } 2. The way I probably would have come at this (and I am still not clear on everything but consider that I am now going about your whole project at a very different angle than you went using printf) is by actually throwing every line of output from gateway into a byte-by-byte check for-loop 3. splitting my output into the four fields (place1-4[$sr]) would actually be a multidimensional array and I would have checked each array element to be equal to nothing but whitespace using the same kind of condition I mentioned in 1. } each $place1[$sr] , $place2[$sr] , $place3[$sr], $place4[$sr] is a dial-in gateway. I go through each gateway, pluck out its call stats and print them out. If there's no gateway, I print N/A (that is there are 3 gw's per site except for the last one that has 5 gw's, therefore the other 3 gateway's for their row 4 +5 have N/A beside them here's the output: ++ |Daily Dial Gateway Call Totals | |for 14 11 2001 | ++ ++ | DG # | Place1 | Place2 |Place3 | Place4 | ++ | 1 | 83018 | 66848 | 87005 | 62313 | | 2 | 76762 | 66734 | 87000 | 62260 | | 3 | 59572 | 57035 | 74555 | 53402 | | 4 | N/A |N/A | N/A | 0 | | 5 | N/A |N/A | N/A | 0 | | 6 | N/A |N/A | N/A | N/A | ++ |Total |219352 |190617 |248560 |177975 | ++ ++ | Grand Total | 836504 | ++ I am trying to prevent the last row of N/A from appearing as there is no gateway 6 therefore the rows should stop at row 5 and row 6 should not appear. I have been at this for a while and can't work out how to do this with sprintf any ideas ? thanks in advance Harry -- ___ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup 1 cent a minute calls anywhere in the U.S.!
formatted text to MAIL
How can I write text to EMAIL ,when I like to format text like that: $luku=5; format Something = Test: @ @| @ $str, $%, '$' . int($num) .. $str = widget; $num = $luku; $~ = 'Something'; write Because , print MAIL sprintf %-6.5s, $itemid; does not give good result.PH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reading and writing to a text file
Seyi Ogunbona wrote: Hi, Hello Two things. Firstly, I would like to know if it is possible to write in a program or script in perl to read a set of two numbers seperated by a comma, I have exported to a text file and the put the numbers in another table as arguements. Yes, it is possible and perl provides a function specifically for this purpose - split(). while ( SOMETHING ) { my ( $one, $two ) = split /,/; Another way to do it is to use a regular expression. while ( SOMETHING ) { my ( $one, $two ) = /(\d+)\D+(\d+)/; Secondly, can you give me directions if yes to above, I have written a script that will take the numbers, and put then in another text file but I am stuck with geting perl to treat them as variables for the next text file. shown below Sorry, I don't understand what you mean by treat them as variables for the next text file. and your example below doesn't help much either. #! usr/bin/perl -w open(PRE, d:\mac.txt) || die cannot open mac.txt for reading: $!; open(POST, info.txt) || die cannot create info_sbu.txt: $!; while (PRE) {# read a line from mac.txt into $_ print POST $_; # print that line to info.txt } #Close(PRE) || die can't close mac.txt: $! ; #close(POST) || die can't close info_sbu.txt: $! ; any suggestions or nudge in the right direction is greatly appreciated John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Q to Japhy about difference sub
On Thu, 22 Nov 2001, Jeff 'japhy' Pinyan wrote: On Nov 21, Pinar 2 said: syntax error at ./shopdiff.pl line 5, near ++ for Execution of ./shopdiff.pl aborted due to compilation errors. You're using an older version of Perl. Do: for (@_) { for (@$_) { $seen{$_}++ } } instead. Thanks that worked. It didn't give me differences though, it gave me the common list items. Perhaps the unique to sub will give the differences but I can't get that one working either. I am using: This is perl, version 5.005_03 built for sun4-solaris is this old? I thought this was the latest available. thanks Japhy! Pinar -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Backticks Command Execution
A better way to get PATH would be: $pat = $ENV{PATH}; (forgive me if this doesn't work in win32-perl, I'm a Unix hacker at heart :) -- How long will a floating point operation float? Mark Veinot Network Administrator Linux Certified Professional - Original Message - From: Veeraraju_Mareddi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, November 22, 2001 9:36 AM Subject: Backticks Command Execution $pat = `echo \%path\%` This should direct output of the echo command to $path variable. But this is not happening,but it displays output to the screen instead. I ran this script in around 200 systems(windows 95 + windows 98),130 out of them produced the required output ,as remining failed. What may be stoping this to happen?.What is scope of the problem to look around. Please help me... Thanx very much With Regards Rajuveera ** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. ** ___ Perl-Win32-Admin mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Backticks Command Execution
$pat = `echo \%path\%` This should direct output of the echo command to $path variable. But this is not happening,but it displays output to the screen instead. I ran this script in around 200 systems(windows 95 + windows 98),130 out of them produced the required output ,as remining failed. What may be stoping this to happen?.What is scope of the problem to look around. Please help me... Thanx very much With Regards Rajuveera ** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting past Use of uninitialized value...
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Etienne Marcotte) wrote: I have: my $q = new CGI; $q-import_names('IN'); my $ID = lib::auth_user($IN::UsrName,$IN::UsrPass); sub auth_user returns a session ID kind of data. $IN::UsrName and $IN::UsrPass are used only once and gives warnings. Etienne I noticed that and used something like this to get around that. # set up major input/output variables in such a way that it supresses # used only once warnings for the variables brought in via the # import_names() sub, but also keep some main-only vars separate from # the dupes to cut down on memory usage. BEGIN { @main::globals = qw($mapname $author $author_first $author_nick $author_last $version $release_date $filename $last_update $email $website_url $website_name $credits $other_levels_by_author $gametype $bot_able $single_player $teamplay $difficulty_settings $new_sounds $new_textures $mutators $mods $construction_base $build_time $editors_used $ext_description $known_bugs $mod_type $mod_description $authors_notes $game $weapons $power_ups $new_music $num_playerstarts ); } # this takes advantage of the fact that use vars is looking for # list context use vars @main::globals, qw($internal_comment1 $style $namefill $output_path $htmlout $textout @htmldata @textdata $current_date); # the namespace used will be ' import_names(UT); ' later in the script package UT; # slip into the package # and slide in our 'globals' that get imported to that namespace use vars @main::globals; package main; # then slide back out to main again. a semi-slick workaround for a semi-ugly problem. supresses all those 'used only once' warnings quite nicely though. -- Scott R. Godin| e-mail : [EMAIL PROTECTED] Laughing Dragon Services |web : http://www.webdragon.net/ It is not necessary to cc: me via e-mail unless you mean to speak off-group. I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]