AW: Perl DBI error

2009-07-07 Thread Thomas Bätzler
Dave Tang d.t...@imb.uq.edu.au asked: I am having a problem with binding a variable when executing on a DBI object. [...] You can only reliably bind values, not field or table names. Database that plan query execution won't accept this, because they need table and field names to make their

AW: Edit text file using perl script

2009-07-07 Thread Thomas Bätzler
Alpesh Naik naik.alp...@gmail.com wrote: Hi Thomas, and thanks for the reply, Given below is my code, #!/usr/bin/perl #!/usr/bin/perl -w = You should always enable warnings. use strict; print Content-type:text/html\n\n; use CGI; my $query = new CGI; = If you're using CGI, then you

AW: File::Find with chmod trouble debugging

2009-07-06 Thread Thomas Bätzler
Harry Putnam asked: The script below is my first usage of perls `chmod', but it appears to be in keeping with the info at perldoc -f chmod. But somehow in the print of $mode it turns into 493... even though it is set to 755. Its just the print though... the actual chmod appears to be

AW: exit status

2009-06-30 Thread Thomas Bätzler
Irfan Sayed irfan_sayed2...@yahoo.com asked: call but in this case how shud i inform to windows batch script that the perl script execution / exit status is non zero and stop execution further Use exit() with a non-zero argument. Look at HELP IF for your windows batch programming question.

AW: Using common object, without passing it around

2009-06-29 Thread Thomas Bätzler
Steve Bertrand st...@ibctech.ca asked: Can anyone suggest a perldoc or recommended practise that will help me in regards to: I have numerous classes, all suited to a different object-type or function. When I instantiate an object (all classes are under the same Module:: umbrella), I

AW: AW: friend class in perl

2009-06-26 Thread Thomas Bätzler
Dr.Ruud rvtol+use...@isolution.nl wrote: Thomas Bätzler wrote: Perl OO doesn't have a notion of friend classes since there is no data hiding anyways Don't lie, of course Perl has data hiding. Yeah, and it's got ACME::Bleach, too, and people still write code using letters and numbers

AW: friend class in perl

2009-06-25 Thread Thomas Bätzler
Roman Makurin dro...@gmail.com asked: I need create a friend class. Is there any special that I need to know ? For now, I get object and work with it like with ordinary reference with direct access to internal fields. Perl OO doesn't have a notion of friend classes since there is no data

AW: imap module

2009-06-24 Thread Thomas Bätzler
Andreas Moroder asked: does a IMAP library exist that supports this functionality: connect to the IMAP server as administrator and create a mail with a attachment in the drafts folder of a specified user. I searched cpan, but from the documentation I dit not find out if the libraries does

AW: ref() or ! ref()

2009-06-23 Thread Thomas Bätzler
Steve Bertrand st...@ibctech.ca wrote: I've got a relatively decent understanding of how references work in Perl (syntax-wise, especially when/how to de-ref), but I'd now like to ask when to use them. Obviously memory allocation isn't an issue anymore, so when exactly should refs be used,

AW: about \r\n or \n

2009-06-22 Thread Thomas Bätzler
Tech W. tech...@yahoo.com.cn asked: I created a script for checking HTTP like below: use strict; use IO::Socket; You should use libwww-perl (the LWP::* module family) instead. Not only does it save you from re-inventing the wheel, but it also helps you to avoid all of the pitfalls of

AW: perldoc perlboot

2009-06-18 Thread Thomas Bätzler
Dave Tang d.t...@imb.uq.edu.au asked: I've been going through perldoc perlboot and I have a question about using the SUPER class. Here's the code in the documentation: #!/usr/bin/perl use strict; use warnings; { package Animal; sub speak { my $class = shift;

AW: file handle in perl

2009-06-17 Thread Thomas Bätzler
Irfan Sayed irfan_sayed2...@yahoo.com asked: i am still not able to modify existing lines in the existing file. here is my code plz help It doesn't work that way. Once you open the file for writing, it's truncated and you can't read the old contents from it anymore. Why don't you use a

AW: AW: file handle in perl

2009-06-17 Thread Thomas Bätzler
Irfan Sayed irfan_sayed2...@yahoo.com wrote: OK. fine now i am able to write in a temp. file after this now i want to overwrite the contents of original file with the contents of temp. file. why i want the original file because i want to use this original file with changes in temp. file in

AW: need help on perl codebeginn...@perl.org

2009-06-16 Thread Thomas Bätzler
Irfan Sayed irfan_sayed2...@yahoo.com asked: I have perl script like this : [...] open (VER1, +, [...] while (VER1) { [...] the issue is that , it is executing properly till while loop but it is not going inside the while and executing while loop. there is no any error and all the files

AW: complex split (when delimiter appears in one of the fields)

2009-06-12 Thread Thomas Bätzler
Michael Alipio daem0n...@yahoo.com asked: I have a string that looks like this: my $string = 1, 3, 0. 0. 0. 0, 22, Zak',adfk $! mac., ; Basically, there are seven fields. after the bird, everything up to the last comma is the 5th field. 6th field is blank. Now my problem is splitting

AW: TCP/IP client

2009-06-10 Thread Thomas Bätzler
Octavian Rasnita orasn...@gmail.com wrote: I was hoping that I could find a module that allows me to do something like: use The::Module; my $client = The::Module-new(PeerAddr = 'localhost:9000'); [...] Use Net::Telnet. From ist description: You're not familiar with sockets and you want a

AW: Efficiently going through results

2009-06-09 Thread Thomas Bätzler
Dave Tang d.t...@imb.uq.edu.au asked: my %result = (); foreach my $parent (keys %listOfParent){ my $chocolate = ''; foreach my $child (keys %{$listOfParent}{$parent}){ foreach ($listOfParent{$parent}{$child}){ $chocolate = $_; Why not foreach my $chocolate

AW: CGI scripting

2009-06-08 Thread Thomas Bätzler
Irfan Sayed irfan_sayed2...@yahoo.com asked: I need to configure Apache web server to execute the CGI scripts (in perl). Servers has windows XP operating system. Did you try Google? The first hit for me on apache windows cgi was: http://www.thesitewizard.com/archive/addcgitoapache.shtml And

AW: Kindly explain special variable $|

2009-05-28 Thread Thomas Bätzler
sanket vaidya sanket.vai...@patni.com asked: It would be great if some of you write a simple code which has two different outputs for $| = 0 $| = 1 to demonstrate the difference. Try this with different values for $| #!/usr/bin/perl -w use strict; $| = 1; for ( 1..20 ){ print .; warn !

AW: Easiest way to graph results

2009-05-06 Thread Thomas Bätzler
Steve Bertrand st...@ibctech.ca asked: This is more of a request for recommendation than it is a 'howto' type question. A couple of years ago, I wrote a Perl program to extract and format data from one of my mail servers, and the results are emailed to me each day. Now I'm considering

AW: if statement being ignored

2009-04-15 Thread Thomas Bätzler
Brian brian5432...@yahoo.co.uk wrote: could someone please help me with this little problem? I am trying to include an if statement part way through printing. When the program reaches the line if ($Lang = fr ) { print that line gets ignored and the cgi keeps going to the end. thanks

AW: Turn off $ anchor greedy behavior

2009-04-14 Thread Thomas Bätzler
Michael Alipio daem0n...@yahoo.com asked: I have a $string that is separated by , and space; boy, pig, 123, 123:412adbd, d0g, lajdlf134_ lkadsf !234, Now I want to capture the string(s) between last two commas. It consists of anything upto 32 characters. that is, right after d0g,\s+ up

AW: AW: Turn off $ anchor greedy behavior

2009-04-14 Thread Thomas Bätzler
Michael Alipio daem0n...@yahoo.com asked: my $string = 'boy, pig, 123, 123:412adbd, d0g, lajdlf134_ lkadsf !234,'; if( $string =~ m/,\s*([^,]*),[^,]*$/ ){ print $1\n; } How could you guys write this so simple? My regexp was twice this long. Lots of practice? ;-) the regexp

AW: Pattern matching question

2009-04-01 Thread Thomas Bätzler
Richard Hobson m...@richardhobson.com wrote: Please be patient with this beginner. I have a subrouting as follows, that prints out an ASCII representation of chess board sub display_board { foreach (0..7) { my $ref = @_[$_]; foreach (0..7) {

AW: perl what

2009-03-17 Thread Thomas Bätzler
Sharan Basappa sharan.basa...@gmail.com wrote: Clearly I did not communicate properly. So what I am looking is for some support to do some GUI stuff. The idea is take information from text and show it in the form a waveform. This will help a lot since it is rather difficult to go through the

AW: join and parenthesis. Is this a bug?

2009-03-03 Thread Thomas Bätzler
freefox robert.lo...@privat.utfors.se asked: As join is a build in I guess it should/could be called without parenthesis. However these two lines gives me two different answers. my @strings = ('foo', 'bar'); my $string1 = q{('} . join q{', '}, @strings . q{')}; my $string2 = q{('} .

AW: Email Purge

2009-02-24 Thread Thomas Bätzler
perl t...@asgweb.net wrote: Cheers and thanks in advance for you help. I have a routine intended to purge duplicate emails from a list. The code below is not working. I remember seeing something like... foreach $email(@emails, @emails2)) { etc ... but I'm lost. Any help is appreciated. This

AW: Bundle-Expect

2009-02-20 Thread Thomas Bätzler
Hi, ramesh.marimu...@wipro.com asked: I'm totally new to Perl. I tried installing a module Bundle-Expect.pm. Also I called inside my Perl script by Use Bundle::Expect. While A bundle is not a module, it's a whole collection of related modules. In this case I suspect you'll probably want to use

AW: Converting a string to a filehandle

2009-02-09 Thread Thomas Bätzler
Taylor, Andrew (ASPIRE) andrew.tayl...@hmrcaspire.com wrote: I'm processing a file of test data that looks something like: FH1,data1,data2,data3,...etc FH2,data1,data2,data3,...etc FH1,data1,data2,data3,...etc Each line split into an array and processed. The first element (FH1, FH2,

AW: Request Tracker 3.8 on Ubuntu 8.04

2009-01-30 Thread Thomas Bätzler
Alf Stockton a...@stockton.co.za I am attempting to install RT3.8 on Ubuntu Hardy 8.04 and am having no end of trouble with perl as I do not understand the language or its environment. Read the provided documentation, please. It clearly tells you to run make fixdeps to fix missing

AW: Query : Exectuting flow in parllel dirs

2009-01-20 Thread Thomas Bätzler
Hi, vivekananda.moh...@wipro.com asked: Any inputs? Lemme know if the Q is ambiguous? Go read the perlipc manual page (perldoc perlipc) and come back if you have questions. HTH, Thomas -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail:

RE: How to create a timezone converter application in Perl !

2008-09-26 Thread Thomas Bätzler
Amit Saxena [EMAIL PROTECTED] asked: Recently I came across a scenario where I need to convert the time from one timezone to another. Though that time, I used few websites for the same but I want to know how to do the same in Perl. See

RE: Regular Expression Question

2008-09-22 Thread Thomas Bätzler
Raymond Wan [EMAIL PROTECTED] wrote: I looked a bit for some etiquette list for this mailing list and couldn't find out. Perhaps it's out there somewhere? You could argue that in absence of any other rules, RFC 1855 applies: If you are sending a reply to a message or a posting be sure you

Quoting Style meta-discussion religious war (was RE: Regular Expression Question)

2008-09-22 Thread Thomas Bätzler
Mr. Shawn H. Corey [EMAIL PROTECTED] sniped with regard to top-posting: Funny that blogs work that way. Do they now? The ones that I tend to read all show the comment section after the article body. Cheers, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

RE: Sending SMS

2008-09-22 Thread Thomas Bätzler
Pat Rice [EMAIL PROTECTED] asked: I'm just wondering whats the best way to send an SMS thought perl ? Has any one experience of doing such a task ? The easiest solution is to use somebody else's HTTP-to-SMS gateway, because then you can use LWP on your end. On the other hand trying to signal a

RE: extracting multiple statements ...

2008-09-22 Thread Thomas Bätzler
Hi, Sharan Basappa [EMAIL PROTECTED] asked: I have a code snippet as follows: keyword id1 = a x b x c; keyword id2 = c x d x e; I would like to extract strings a x b x c and c x d x e. I know I can loop through the code and extract the strings, but is there a RE that can do this with

RE: change the ownership of my script

2008-09-19 Thread Thomas Bätzler
Manasi Bopardikar [EMAIL PROTECTED] asked: I want to change the ownership of my perl script through my script.Currently it is root .I want to change it to apache. I am using system(chown apache:apache simple.pl); Simple.pl is the name of my perl script See perldoc -f chown on how to

RE: Variable passing to functions like read() / sysread() etc

2008-09-19 Thread Thomas Bätzler
Hi, [EMAIL PROTECTED] wrote: When using read/sysread you pass variables like $fo-sysread($buf, $buflen), and the data is returned in buf. This is magic to me, normally you ought to call sysread like $fo- sysread(\$buf,$buflen), passing a reference/pointer to the buffer. Apparantly

RE: Round a digit in perl

2008-09-12 Thread Thomas Bätzler
Hi, V.Ramkumar [EMAIL PROTECTED] asked: My input xml file has, citspn246/citspndelimndash;/delimcitepn52/citepn I have to replace, citspn246/citspndelimndash;/delimcitepn252/citepn Similarly, 100-5 100-105 198-10198-210. If anybody have logic for the above, please

RE: Oraperl and DBI !

2008-08-14 Thread Thomas Bätzler
Amit Saxena [EMAIL PROTECTED] wrote: I have read somewhere in web that Oraperl is a wrapper around DBI. [...] Please confirm. http://www.google.com/search?q=dbi+oraperl+history HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Code not working as desired !

2008-08-01 Thread Thomas Bätzler
Rob Dixon [EMAIL PROTECTED] wrote: My apologies. There was a mistake in my code in that I was using the special variable $a for this loop. I should have written something like this: my %h; print Matrix is as follows :- \n; foreach (@arr) { my @vals = @$_; print Row =

RE: can perl program do this?

2008-07-31 Thread Thomas Bätzler
Richard Lee [EMAIL PROTECTED] asked: [Full quote deleted. Please quote only the relevant parts of the mail you're replying to. Thank you!] but I am interested in grepping out the pcap file so I cannot simply just do grep Please use some common sense. You can't use Net::Pcap on host X to

RE: Use of uninitialized value in concatenation (.) or string

2008-07-25 Thread Thomas Bätzler
luke devon [EMAIL PROTECTED] asked: Following error i am getting while its functioning. Could you please help me to find out what the error is ? Use of uninitialized value in concatenation (.) or string at /xxx.pl line 18, STDIN line 1. Use of uninitialized value in concatenation (.) or

RE: Difference between = and = in Perl !

2008-07-24 Thread Thomas Bätzler
Amit Saxena [EMAIL PROTECTED] wrote: What's the difference between = and = in Perl ? From perldoc perlop: Comma Operator Binary , is the comma operator. In scalar context it evaluates its left argument, throws that value away, then evalu- ates its right argument and

RE: Kicking off a perl script with alternate credentials

2008-07-24 Thread Thomas Bätzler
HESTER, CHRISTOPHER [EMAIL PROTECTED] asked: I've got a script that, given certain conditions, may need to kick off another perl script as another user (for which I have the username and password). Is this possible? I can't find any information on it searching online and have limited

RE: how to convert data available from excel to hash?

2008-07-21 Thread Thomas Bätzler
Amit Saxena [EMAIL PROTECTED] wrote: On Mon, Jul 21, 2008 at 11:22 AM, Sivasakthi [EMAIL PROTECTED] wrote: Hi all, How to convert data available from excel sheet to hash table? If the data is not very complicated, convert the excel into .csv file and then read that file line by

RE: OO method query

2008-07-21 Thread Thomas Bätzler
Dermot [EMAIL PROTECTED] asked: I am trying my hand at creating an package and am a bit unsure about some of the inner working of what I've done. I recommend http://books.perl.org/book/171 Q3) In new, can I allow for the object create being done with more argument like my $page = new

RE: LWP

2008-07-18 Thread Thomas Bätzler
[EMAIL PROTECTED] [EMAIL PROTECTED] asked: Can someone assist me in modifying the the script below to support the following: 1)define proxy server 2)the URL being accessed via LWP is protected, so I need to specify username/passwd combo This is OTTOMH: use LWP::UserAgent; # instead of

RE: LWP

2008-07-18 Thread Thomas Bätzler
John Edwards [EMAIL PROTECTED] wrote: Thomas, I will give this a try, however I am unclear on the 'my $realm' declaration --what exactly am I supposed to put here? The protected document is protected by Siteminder, where I have to put in a username/password, once this is done I can access the

RE: Doubt in Perl CGI

2008-07-17 Thread Thomas Bätzler
Prabu Ayyappan [EMAIL PROTECTED] asked: My Perl CGI script is working fine when i run the code in the command prompt as perl myscript.cgi . However when i run the same code in the browser(Internet Explorer), It is not working properly. Have you tried running the script as the user id the

RE: How can we Install Perl in Windows

2008-07-17 Thread Thomas Bätzler
[EMAIL PROTECTED] wrote: No one here believes in the CygWin package? Four words: wart on a wart. Cheers, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: Compare Excel file

2008-07-15 Thread Thomas Bätzler
Sivasakthi [EMAIL PROTECTED] asked: Gunnar Hjalmarsson wrote: Sivasakthi wrote: Is it possible to compare two excel file by using Perl? Yes. How can we do that? .. or direct me to right document. Use Spreadsheet::ParseExcel

RE: using mysql NULL with IF statement

2008-07-14 Thread Thomas Bätzler
Huub [EMAIL PROTECTED] asked: I'm adapting a Perl script using MySQL connectivity, and have to compare a variable, e.g. $myvar, with the value NULL from the database. In MySQL, I have to use the query 'where myvar is null', which works great. But when I try this in Perl, like 'if ($myvar

RE: Perl script doesnt behave well

2008-07-14 Thread Thomas Bätzler
luke devon [EMAIL PROTECTED] asked: I am using perl script to handle some function of squid redirector program . Actually its working fine. But after some time , that functions goes off. That's meant VALUE-A doesnt comes in to the request. Is it possible that your script has lost the

RE: Define NULL value in Perl

2008-07-09 Thread Thomas Bätzler
luke devon [EMAIL PROTECTED] asked: How can we define NULL values in perl ? for instance if I wanted to assign a NULL value for a variable called $x= , how would it be in the code ? NULL is a SQL term. The Perl equivalent is undef, i.e. $x = undef; To check for definedness of a variable,

RE: how to read the last line of a file directly?

2008-07-07 Thread Thomas Bätzler
loody [EMAIL PROTECTED] asked: I try to read the last line of a file directly instead of using while() or something else to read each line until undef bumped to me. If you know some build-in functions or another modules for me to use, please help me. Off the top of my head:

RE: Getting file type in perl

2008-07-07 Thread Thomas Bätzler
Rajnikant [EMAIL PROTECTED] asked: Unix command file gives file type of that file. # file a.txt.gz a.txt.gz: gzip compressed data, was a.txt, from Unix How can I achieve same in perl? Using a module like http://search.cpan.org/~pardus/File-MimeInfo-0.15/lib/File/MimeInfo/Magic.pm HTH,

RE: Getting file type in perl

2008-07-07 Thread Thomas Bätzler
Rajnikant [EMAIL PROTECTED] wrote: Thanks Thomas. I tried same with File::Type :). I considered that module, too, but it's got some problems: http://cpanratings.perl.org/dist/File-Type While I don't mind the memory footprint, I would rather have a module that uses a magic file that can

RE: play sounds

2008-07-03 Thread Thomas Bätzler
Jennifer G. [EMAIL PROTECTED] asked: How to make a perl program under windows to play sounds? thanks. http://search.cpan.org/~jdb/Win32-Sound-0.49/ HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: @INC and cross-platform path usage

2008-07-01 Thread Thomas Bätzler
Tobias Eichner [EMAIL PROTECTED] wrote: I have created a Perl library that I want to use with my programs (via require). However the Perl library should be placed at a sub-folder of the working directory (the place where the program runs). For example: /my/custom/path/ is the location

RE: @INC and cross-platform path usage

2008-07-01 Thread Thomas Bätzler
Gunnar Hjalmarsson [EMAIL PROTECTED] wrote: Some would suggest the use of the FindBin module. It does the right thing, but unfortunately it is known to be buggy. Actually, I wish more modules were as buggy as FindBin ;-) I.e. that they would work robustly for all of the common usage cases and

RE: returning file info to C code

2008-06-25 Thread Thomas Bätzler
shorti [EMAIL PROTECTED] asked: Hello, I am a C coder but new to Perl. I am running in an AIX environment. I was wondering if there was a Perl way to return string data (or larger int values) to a C program? You exchange data with a Perl program in the same way you'd exchange data with any

RE: First perl program

2008-06-19 Thread Thomas Bätzler
Hi, Jason B [EMAIL PROTECTED] wrote: I'm really new to programming and this is my first perl prog. I'm looking for any advice or comments on this script. Enable warnings and use strict;. That'll help you to write better code. #!/usr/bin/perl #!/usr/bin/perl -w use strict;

RE: sophisticated diff

2008-06-16 Thread Thomas Bätzler
Noah [EMAIL PROTECTED] asked: I need to a nice, sophisticate way to compare lines between two files. Is the order of the lines relevant (i.e. source code, etc.)? I know that sorting can help in comparison process but still one file might have additional lines between the lines that are

RE: how to manipulate word using perl

2008-06-10 Thread Thomas Bätzler
Hi, I facing a problem to substitute extensions of file with = For example: In a file I have names of some files a.txt b.txt c.txt I want them to a= b= c= Do you just want to change the text in that file, or is that file a list of filenames that you want to process?

RE: pie multiline replace

2008-06-05 Thread Thomas Bätzler
bill lam [EMAIL PROTECTED] asked: Suppose I want to change 2 lines to 3 line in files as follow using perl -p -i -e command aa bb aa cc bb this doesn't work perl -p -i -e s/aa\nbb/aa\ncc\nbb/g; foo.txt That won't work since you ever only see a single line of input. Since you don't

RE: about readdir call

2008-06-05 Thread Thomas Bätzler
Rajnikant [EMAIL PROTECTED] asked: I'm reading one directory using readdir call. but I'm getting different output from that I got by running ls -l command on same directory manually. Following is the snippet I'm using: #!/usr/bin/perl -w $dirname = '/test_dir'; opendir ( DIR, $dirname )

RE: How to Read Files? [was: Re: learning perl 3rd vs 4th]

2008-05-26 Thread Thomas Bätzler
AndrewMcHorney [EMAIL PROTECTED] asked: The spec does not allow for carriage returns or line feeds making it a long line. Is there a way to read x number of bytes? $ perldoc -f read read FILEHANDLE,SCALAR,LENGTH,OFFSET read FILEHANDLE,SCALAR,LENGTH Attempts to read LENGTH

RE: Writing side of square

2008-05-05 Thread Thomas Bätzler
Rodrigo Tavares [EMAIL PROTECTED] asked: I need create a square using a single number, but I don't know how to create the sides. #!/usr/bin/perl -w use strict; for( my $n = 1 ; $n = 10; $n++ ){ print \nn = $n\n\n; if( $n == 1 ){ print *\n; } else { print '*'x$n . \n; for(

RE: how to look back past hour

2008-04-02 Thread Thomas Bätzler
Richard Lee [EMAIL PROTECTED] asked: What is the best way to indicate past hour from current time without using a module? [...] #!/usr/bin/perl -w use strict; printf %d:%02d to %d:%02d\n, (localtime time - 3600 )[2,1], (localtime time)[2,1]; __END__ my $time = localtime; my @time_1 =

RE: simple reg ex matching

2008-04-02 Thread Thomas Bätzler
[EMAIL PROTECTED] wrote: ok, I found my error, it should be as follows if I want to match number 6:- my $_ = 62; if( $_ =~ /^6$/){ Of course you could also just use if( $_ == 6 ). HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: parse x.500 DN and change order displayed

2008-03-31 Thread Thomas Bätzler
Peter Scott [EMAIL PROTECTED] wrote: On Sun, 30 Mar 2008 20:36:58 -0700, SecureIT wrote: I am trying to change this cn=Bob Smith+serialNumber=CR013120080827,o=ICM,c=US to this: serialNumber=CR013120080827+cn=Bob Smith,o=ICM,c=US s/^(cn=.*?)+(.*?),/$2+$1,/; Close, but no

RE: help in while loop

2008-03-17 Thread Thomas Bätzler
[EMAIL PROTECTED] asked Can somebody please let me know the meaning of this line. while ($in) { if(/,/) {print before match: $`\t and after match: $'\n\n;}; $x=$'; $y=$`; mysubroutine($x,$y); } The loop iterates over a filehandle, setting $_ to each line in turn. If that line

RE: Variables initialization

2008-03-17 Thread Thomas Bätzler
[EMAIL PROTECTED] asked; How is it possible to initialize variable using 0 or '' and not having undef warning later on using them? my $variable = 0; # = initial value goes here HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: help in while loop

2008-03-17 Thread Thomas Bätzler
[EMAIL PROTECTED] asked: I have certain doubts. What's the meaning of if mysubroutine was defined with prototypes and you were trying to disable that sentence. Could you please elaborate that what's the meaning of this??? When declaring a subroutine, you can optionally also declare a

RE: Sum not producing zero

2008-03-12 Thread Thomas Bätzler
Hi, Below is a small script and results... Can someone example what I am doing wrong - the sum should produce zero but does not. Don't use floating point math for accounting - convert your money sums to cents first and use these for calculation. HTH, Thomas -- To unsubscribe, e-mail:

RE: debugging code that freezes

2008-03-06 Thread Thomas Bätzler
Joseph L. Casale [EMAIL PROTECTED] asked: In another list, I am baffled by the instability of a Perl script that freezes after some time for a user. What can be done to run a Perl script in a debug like mode such that all system calls could be logged so that one could see what was

RE: FTP server

2008-03-06 Thread Thomas Bätzler
Octavian Rasnita [EMAIL PROTECTED] asked: Can anyone recommend a good FTP server for Linux? I want to be able to create/delete users dynamicly from a perl program, assign permissions dynamicly, and it would be good (although not absolutely necessary) to have SSL support. I'm not sure what

RE: Tokenizing a string

2008-02-11 Thread Thomas Bätzler
Allam Reddy, Thomas [EMAIL PROTECTED] asked: I have a string jdbc/abc.xml which I wanted to tokenize using the delimiter / May I know the perl code for this? my $string = 'jdbc/abc.xml'; my @tokens = split /\//, $string; print 'Tokens: ' , join( ',', @tokens ), \n; HTH, Thomas -- To

RE: more fun with $main::

2008-02-08 Thread Thomas Bätzler
Jonathan Mast [EMAIL PROTECTED] wrote: Can you use the $main:: convention from inside a module to call a script subroutine? I know it can be used to reference fields from a script, but we seem to be having problems when trying to call a subroutine. Please don't do that, it's evil. If you

RE: more fun with $main::

2008-02-08 Thread Thomas Bätzler
Jonathan Mast [EMAIL PROTECTED] asked: ok, how do I do that? Braindead minimal example: #!/usr/bin/perl -w use strict; package Sample::Callback; # constructor takes a function reference as argument sub new { my( $class, $callback ) = @_; my $self = { 'cb' = $callback }; bless $self,

RE: passing array reference from one perl script to another perl scirpt

2008-01-24 Thread Thomas Bätzler
[EMAIL PROTECTED] wrote:e solution for this? What I see is that , reference is received in next program but I am not able to access the hash after dereferencing it. I was passing the hash reference. Ever since memory management units (MMU) became all the rage, processes (or program if you

RE: array index

2007-09-11 Thread Thomas Bätzler
Pavanvithal Torvi [EMAIL PROTECTED] asked: While debugging a script I came across a scenario where array access was happening with a negative index. (because of a corner case that was not properly handled). This resulted in accessing the array in a reverse order. [...] I wanted to ask

RE: Use tk

2007-09-03 Thread Thomas Bätzler
Somu [EMAIL PROTECTED] asked: When we use tk, there is always the black DOS window. How can we make it disappear? If you're using ActiveState's Win32 port, you can use the wperl.exe binary instead of plain old perl.exe. HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

RE: Multiple file perl program

2007-07-20 Thread Thomas Bätzler
[EMAIL PROTECTED] asked: How do I write a multiple file perl program? I dont want to conflict with any real module names that were built in or are on CPAN. I just want to spread some subs onto some other files. Just choose a suitable namespace prefix like Local:: or your company Name for

RE: a question write to file!

2007-07-05 Thread Thomas Bätzler
herostar1981 [EMAIL PROTECTED] asked: I have a big question. why are the contents different between what I write to file and what print in screen? Obviously you are doing something wrong ;-) If you want us to help you, please send a minimal code sample that demonstrates your problem.

RE: foreach broken in my script

2007-07-04 Thread Thomas Bätzler
Joseph L. Casale [EMAIL PROTECTED] wrote: I have a list: @list = ('Exchange','Filter','DNS','Domain'); This is a list of arrays I also have of course to leverage this I am trying to . the @ symbol on it during use. foreach $vm (@list) { my_sub(@ . $vm);

RE: shuffling cards

2007-06-28 Thread Thomas Bätzler
Amichai Teumim [EMAIL PROTECTED] asked: I want to shuffle a deck of cards and then print out the top five cards. Read the Perl faq entry on shuffling arrays (i.e. perldoc -q shuffle). If you're using a fairly recent version of Perl, this'll get you started. #!/usr/bin/perl -w use strict;

RE: Query an IP from file

2007-05-22 Thread Thomas Bätzler
Hi, Jeff Pang [EMAIL PROTECTED] asked: I have a text file which contains lots of IPs,like: 58.253.0.0/16; 58.254.0.0/16; 58.255.0.0/16; 60.0.0.0/16; 60.1.0.0/16; 60.10.0.0/16; 60.16.0.0/16; 60.17.0.0/16; 60.18.0.0/16; 60.19.0.0/16; 60.2.0.0/16; 60.20.0.0/16; 60.21.0.0/16;

RE: Convert german umlaut to ascii

2007-05-21 Thread Thomas Bätzler
Martin Barth [EMAIL PROTECTED] suggested: On Mon, 21 May 2007 08:41:13 +0200 Andreas Moroder [EMAIL PROTECTED] wrote: Hello, in our application I have to convert all german Umlaute in a string to a two char combination ä to ae, Ö to OE and so on. Can anyone please tell me

RE: Regarding files

2007-05-21 Thread Thomas Bätzler
Hi, Dharshana Eswaran [EMAIL PROTECTED] wrote: Keeping the classic (state machine) approach in mid, i tried writing a logic for the same But i am not able to retrieve the lines accurately, Can you please help me with a small piece of code for the same logic which you mentioned? This

RE: how to know the object type

2007-04-03 Thread Thomas Bätzler
Anish Kumar K [EMAIL PROTECTED] In java we have instance operator to tell the type of Object. Similarly in perl say I am passing a reference object to a function, Is it possible to detect in the function whether the object is HASH or ARRAY... The function ref does what you want. HTH,

RE: using perl ot connect to a database

2007-03-15 Thread Thomas Bätzler
Hi, FamiLink Admin [EMAIL PROTECTED] asked: I am trying to connect to a database using a small script but get this error: failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' perl Try mysql show variables like 'socket';

RE: whilereach my $variable (FILEHANDLE) ???? (sort of like foreach my $variable (@array)

2007-01-15 Thread Thomas Bätzler
Hi, Michael Alipio [EMAIL PROTECTED] asked: I've been thinking about this for quite some time now. Suppose I have a text file (mypet.log that contains: dog pig cat Then I have another text file and I want to read it line by line and extract each line that has those contained in the

RE: Storing filehandles(for writing) in hashes doesn't work (Re: whilereach my $variable (FILEHANDLE) )

2007-01-15 Thread Thomas Bätzler
Hi, Michael Alipio [EMAIL PROTECTED] wrote: Ok, seems like a pet logs is not a good example.:-) Let me revise my story: I have a logfile which contains different clients firewall's logs. Let's say the log file is: firewall.log Now each line in the logfile has a $deviceid string

RE: run command in a particular dir

2007-01-08 Thread Thomas Bätzler
[EMAIL PROTECTED] [EMAIL PROTECTED] asked: I need to run a particular command cleartool des from a partiuclar folder. Try chdir 'm:/Arun Main' or die Can't change CWD: $!: HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: What is 'new' doing?

2006-11-22 Thread Thomas Bätzler
Mathew Snyder [EMAIL PROTECTED] asked: In this line of code what is 'new' doing? my $users = new RT::Users(RT::SystemUser); It's trying to look like a Perl built-in when in fact it's just a method of the RT::Users class.The above code is equivalent to writing my $users =

RE: How to parse UNIX commands ...

2006-10-27 Thread Thomas Bätzler
Hi, [EMAIL PROTECTED] asked: How do I parse or evaluate the output of UNIX commands? For example, in UNIX scripts, I can run filesystem=`df -k | awk -F ' { print $6 }'` to check for the mount points. How do I achieve the same in Perl? That is, I tried: Essentially in the same way -

RE: Extract barcodes from text file

2006-10-13 Thread Thomas Bätzler
Jack Daniels (Butch) [EMAIL PROTECTED] wrote: Have spent the last couple hours searching Internet, reading my perl books, but I just can't figure it out. Problem: Our barcodes are 14 digits, however not all employees have a scanner when associating the barcode with an item. Barcodes are

RE: logfile rotation

2006-10-13 Thread Thomas Bätzler
Tim Wolak [EMAIL PROTECTED] asked: I'm working on rotating log files and am using the logfile::rotate module. What I need to do is add the date to the file name that is being created. What exactly are you trying to achieve? If you add dates to the filenames, you're not rotating them

<    1   2   3   4   >