Re: searching a whole array without using a loop

2004-08-24 Thread James Edward Gray II
On Aug 24, 2004, at 7:48 AM, Darren Birkett wrote: OK, to be more specific, I'm using Net::Telnet:Cisco. When logged onto a device I'm using the show version command, and storing the output in an array. Each element of the array will therefore contain lots of rubbish. I just want to match

Re: searching a whole array without using a loop

2004-08-24 Thread James Edward Gray II
On Aug 24, 2004, at 9:14 AM, Gunnar Hjalmarsson wrote: Isn't grep() specific enough? Initially you said: $line = join(' ',@myarray); if ($line =~ /my string/) { some code } The equivalent using grep() would be: if ( grep /my string/, @myarray ) { some code }

Re: Sed-type-function

2004-08-23 Thread James Edward Gray II
On Aug 23, 2004, at 10:50 AM, Dave Kettmann wrote: I guess and easy syntax for search and replace similar to: s/this/that/g ... Perl supports this exact syntax, so you are confusing a lot of us now... :D James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: Sed-type-function

2004-08-23 Thread James Edward Gray II
On Aug 23, 2004, at 2:31 PM, Dave Kettmann wrote: Ok ... I'm going to try to confuse everyone again because either a) I'm dense or b) I'm asking the wrong question. Everyone can agree with option a, and I will not get mad :). Ok .. here goes again... For future reference, we prefer you submit

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 10:55 AM, Christopher J. Bottaro wrote: say i have two strings and . i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. perldoc -f substring Come back if you need a bigger hint. ;) James -- To unsubscribe,

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 10:55 AM, James Edward Gray II wrote: On Aug 19, 2004, at 10:55 AM, Christopher J. Bottaro wrote: say i have two strings and . i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. perldoc -f substring Egad

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 11:55 AM, Christopher J. Bottaro wrote: Gunnar Hjalmarsson wrote: You can use substr() as an rvalue: substr($str1, 4, 8 - length $str1, $str2); or if the length of $str1 is given: substr($str1, 4, -4, $str2);# probably fastest i don't understand why the

Re: How to read data from and Excel File

2004-08-13 Thread James Edward Gray II
On Aug 11, 2004, at 1:02 PM, jason corbett wrote: Do I need to have a special module to open/read an Excel spreadsheet, parse it, etc.? It's sure a LOT easier with a module. I would definitely go that way... I am trying to figure out if one is needed and what module is recommended. I went on

Re: Translate sed / Perl

2004-08-13 Thread James Edward Gray II
On Aug 13, 2004, at 8:19 AM, Errin Larsen wrote: Hey guys (and gals, I imagine!), Hello. I'm really new to perl. I've been working through some beginners tutorials and now I need (want!) to use perl to overhaul something I wrote in the past. I've got a script (in bash) that I use that has a

Re: PERL and Mobile Devices.

2004-08-13 Thread James Edward Gray II
On Aug 10, 2004, at 3:35 PM, JupiterHost.Net wrote: I remember hearing some cell phones had perl and maybe PDA's??? Really? I would be very interested to know what cell phone that is... Perl has a pretty big overhead compared to what mobile devices offer. I've seen ports for Windows CE and the

Re: Trying To write a script

2004-08-09 Thread James Edward Gray II
On Aug 9, 2004, at 9:05 AM, Singh, Harjit wrote: I am trying to write a script that would be able to read a file. The file is broken into number of segments and each segment starts with a similar string pattern of following type: 2.2.x.y.z: followed with white space, where x, y, z numbers change

Re: Assignment for Perl Class- hurting my brain

2004-08-09 Thread James Edward Gray II
(Let's keep our discussion on the list, for all to help and learn.) On Aug 8, 2004, at 11:08 PM, William Paoli wrote: The field format of the file is structured like this: Car Number:Driver Name:Sponsor:Owner:Crew Chief:Car Make:Mini Biography:Team Name I couldn't tell, are you struggling with

Re: Trying To write a script

2004-08-09 Thread James Edward Gray II
On Aug 9, 2004, at 3:36 PM, Singh, Harjit wrote: The following code is what I used to check if item number could be detected for the file I sent in the earlier email. The code seems to have failed and need a advise on it.. #!C:\perl\bin\perl5.6.1 $file1 = ' C:\perl\bin\dummy.txt' ; open (INFO,

Re: Assignment for Perl Class- hurting my brain

2004-08-08 Thread James Edward Gray II
On Aug 8, 2004, at 2:24 AM, William Paoli wrote: Im not looking to cheat, just a push in the right direction. It's hard form me to help you much, without showing code. And of course, if I use something you're teacher hasn't taught yet... Still, I'll try to give a hint or two. [snip] The field

Re: finding out what is uninitialized

2004-08-03 Thread James Edward Gray II
On Aug 3, 2004, at 9:12 AM, Gunnar Hjalmarsson wrote: where the @fund_array is defined by : push(@fund_array,$cat_key\|$title\|$url\|$code\|); If that's the only way @fund_array gets populated, there is no way it can contain undefined elements. Is the warning pointing to the push() line though?

Unusual Exporting

2004-08-02 Thread James Edward Gray II
I have a module that needs to export a hash and a subroutine. I used Exporter and that's now happening, but there's a catch... I need the subroutine to make changes to that hash, when called. (I'm aware this is an unusual interface and I do have good reasons for wanting to do it.) I can't

Re: Unusual Exporting

2004-08-02 Thread James Edward Gray II
Sorry to answer my own question but... On Aug 2, 2004, at 1:37 PM, James Edward Gray II wrote: #!/usr/bin/perl package MyExporter; use strict; use warnings; use Exporter; our @ISA = 'Exporter'; our @EXPORT = qw/ %hash routine /; our %hash = (Test = 'Works!'); sub routine { my($caller

Perl Core

2004-07-31 Thread James Edward Gray II
Quick question: What's the best way to find out if a module is standard in the Perl Core and if it is, when it was added? Thanks. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Perl Core

2004-07-31 Thread James Edward Gray II
On Jul 31, 2004, at 11:30 AM, Randy W. Sims wrote: On 7/31/2004 12:24 PM, James Edward Gray II wrote: Quick question: What's the best way to find out if a module is standard in the Perl Core and if it is, when it was added? Check out Module::CoreList http://search.cpan.org/dist/Module-CoreList

Re: deleting HTML tag...but not everyone

2004-07-29 Thread James Edward Gray II
On Jul 29, 2004, at 7:52 AM, Francesco del Vecchio wrote: Hi guys, Hello. I have a problem with a Regular expression. I have to delete from a text all HTML tags but not the DIV one (keeping all the parameters in the tag). This is a complex problem. Your solution is pretty naive and will only

Re: Endless Loop

2004-07-29 Thread James Edward Gray II
On Jul 29, 2004, at 9:23 AM, BOLCATO CHRIS (esm1cmb) wrote: This may be a dumb question, but why will this loop not end when nothing is entered in STDIN? STDIN is a stream. A blank line does not constitute the end of a stream. I believe your can signal an end to the stream in most terminals

Re: sort by extension

2004-07-29 Thread James Edward Gray II
On Jul 29, 2004, at 10:42 AM, perl.org wrote: Thanks for the detailed response. Anytime. It's easier to read that code bottom to top, so let's start with: map { m/\.([^.]+)$/ ? [$_, $1] : [$_, ''] } @input; Unfortunately I really don't find this easy to read. That's unfortunate, because I

Re: sort by extension

2004-07-29 Thread James Edward Gray II
On Jul 29, 2004, at 11:23 AM, perl.org wrote: On Thu, 29 Jul 2004 12:08:20 -0400 (EDT), Jeff 'japhy' Pinyan wrote That's why he broke it down. Is the map() really the problem, or is it the regex, the ?: operator, and the two array references? All of the above ;), but now that I think about it the

Re: sort files by extension

2004-07-28 Thread James Edward Gray II
On Jul 28, 2004, at 12:27 PM, perl.org wrote: I have a list of files I want to case-insensitive sort by extension, files with no extension appearing first. It should handle both Windows and Unix directory separators. I think I have working code, but I am interested in the various syntax for

Re: sort by extension

2004-07-28 Thread James Edward Gray II
(Let's keep our discussion on the list for all to help and learn, please.) On Jul 28, 2004, at 12:55 PM, John West wrote: James Edward Gray II [EMAIL PROTECTED] On Wed, 28 Jul 2004 12:41:08 -0500, James Edward Gray II wrote I'm never one to abuse working code, but if your definition of better

Re: sort files by extension

2004-07-28 Thread James Edward Gray II
On Jul 28, 2004, at 2:26 PM, [EMAIL PROTECTED] wrote: Maybe I'm missing something but since you're doing Schwartzian Transformation already why call lc() every time? @input = map { $_-[0] } sort { $a-[1] cmp $b-[1] } map { m/\.([^.]+)$/ ? [$_, lc($1)] : [$_, ''] }

Re: Multiple Parameters

2004-07-26 Thread James Edward Gray II
(Let's keep our discussion on the list so all can help and learn.) On Jul 25, 2004, at 8:09 PM, [EMAIL PROTECTED] wrote: OK i still can't figure this out, i understand what you explained but i still can't figure out why it doesn't want to write to the new file and also why it only removes the

Re: Multiple Parameters

2004-07-26 Thread James Edward Gray II
On Jul 26, 2004, at 6:29 PM, [EMAIL PROTECTED] wrote: Thank you very much for your help, but i have one more question, is this the way that regex works or is it something in my code, every time i try to run the script to search for a comma and replace it with a new line character (\n) it just

Re: Regex to do /match/match/replace?

2004-07-26 Thread James Edward Gray II
On Jul 26, 2004, at 8:17 PM, Ian Marlier wrote: Hi, all -- I've got another RegEx question, a follow-up to one that I asked earlier today: Given a string that looks like this: This is a (string of words) that go together I need to turn it into this: This is a (stringofwords) that go together

Re: Multiple Parameters

2004-07-25 Thread James Edward Gray II
at script.pl line 11, line 1. Can't open \n: No such file or directory at script.pl line 11, line 1. Can't open new.txt: No such file or directory at script.pl line 11, line 1. Why am i getting these errors, and how can i fix this? Thanks in advance. -Original Message- From: James Edward

Re: Multiple Parameters

2004-07-24 Thread James Edward Gray II
On Jul 24, 2004, at 11:38 AM, [EMAIL PROTECTED] wrote: I am trying to write a search and replace script that can accept multiple arguments, but i want the first argument to be the filename to read, the next one to be the string to search for, the next one to be the replacement string, and the

Re: New Line / Chomp Query

2004-07-23 Thread James Edward Gray II
On Jul 23, 2004, at 7:16 AM, Bob Showalter wrote: On Mac systems, the terminator is something different (not sure what), but the same concept applies as for Windows AFAIK. Mac OS 9 and below used a single CR (0x0D) as the line terminator. Mac OS X is a Unix-ish system, as you described it, and

Re: How do it do find and replace specific words using perl

2004-07-23 Thread James Edward Gray II
On Jul 23, 2004, at 5:13 AM, [EMAIL PROTECTED] wrote: Hi All, Hello. Could some help me in doing this using perl. We will help, yes, but we probably won't write it for you. What have you tried. Where are you stuck? Show us some code. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: New Line / Chomp Query

2004-07-23 Thread James Edward Gray II
On Jul 23, 2004, at 7:56 AM, Bob Showalter wrote: Thanks. Is translation to LF performed on input/output (a la Windows), or is $/ set to CR on those systems? No translation. $/ was set to CR and even \n gave you a CR. Luckily, as I said before, Mac OS X is a much more native Perl, being in the

Re: How do it do find and replace specific words using perl

2004-07-23 Thread James Edward Gray II
On Jul 23, 2004, at 8:14 AM, [EMAIL PROTECTED] wrote: Hi James, Hello again. I was trying this but not sure where it is going wrong ... There you go. Now I'll help... ;) use strict; use File::Copy; You import, but do not use the above module. We don't need it. my $dest_file =

Re: Problem with compiling a script

2004-07-21 Thread James Edward Gray II
On Jul 21, 2004, at 8:35 AM, Paul Smith wrote: Dear All I am trying to run the script below, but I always get the following error: [EMAIL PROTECTED] scripts]$ secondperl Global symbol $greeting requires explicit package name at /home/paulus/scripts/secondperl line 6. Global symbol $greeting

Re: Problem with compiling a script

2004-07-21 Thread James Edward Gray II
On Jul 21, 2004, at 8:47 AM, Paul Smith wrote: Bingo, James! Sorry for my ignorance, but I am just beginning with Perl. Not a problem. Brand new to Perl and already using strict, you're off to the perfect start. Welcome. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Another Perl datatype headache ( scalars $, hashes %, and arrays @ )

2004-07-19 Thread James Edward Gray II
On Jul 18, 2004, at 7:59 PM, gohaku wrote: Hi everyone, Howdy. after writing perl scripts for about 3 years now, I still have trouble with the basic datatypes. I know that variables that start with '$' are scalars. This covers Hashes ($HASH{$key}), Arrays ( $_[0] ), and regular scalar values (

Re: Edit a file inplace..

2004-07-19 Thread James Edward Gray II
On Jul 19, 2004, at 10:56 AM, [EMAIL PROTECTED] wrote: Hi, I am trying to edit an ASCII file in place I tried perl -pi -ne s/ERROR/TRACKED/g status.log Well, we definitely don't need -p and -n, since -p is -n plus some. and received Can't do inplace edit without backup Okay, let's

Re: symbolic references in perl module help

2004-07-16 Thread James Edward Gray II
On Jul 16, 2004, at 7:54 AM, Luis Pachas wrote: Hi I have a problem, I have a PM i have this A.pm : package A; my %b; $b = { apple = \foo1, oranges = \foo2, open = \foo3 }; sub foo1 { print apples\n } sub foo2 { print oranges\n } sub foo3 { my ($item) = @_; print $item.\n } 1; ##

Re: Pattern Matching records from a table query.

2004-07-16 Thread James Edward Gray II
On Jul 16, 2004, at 3:46 PM, jason corbett wrote: I want to eliminate the . (periord) or , (comma) from records that I return from a query, but I cannot figure out how to approach it. Does Perl have a way that I can match a string that from an array, remove a character or characters? For

Re: Help translate into Perl

2004-07-16 Thread James Edward Gray II
On Jul 16, 2004, at 4:51 PM, Mike Blezien wrote: hello, I have been given some programming code that I need to convert or translate into perl coding, and I was hoping someone on this list maybe able to help me out. What have you tried? We will help you when you get stuck, but we won't write it

Re: foreach (from a file)

2004-07-15 Thread James Edward Gray II
On Jul 15, 2004, at 9:40 AM, Brian Volk wrote: Hi All, If I have a file, /usr/bin/my_urls.txt which contain... urls... :-) one on each line. Can I read these into a foreach statement instead of listing them individually? I think I need to use a filehandle to open the file and then send that

Re: foreach (from a file)

2004-07-15 Thread James Edward Gray II
On Jul 15, 2004, at 10:33 AM, Brian Volk wrote: Am I getting close...? Sure are. my $file = /Program Files/OptiPerl/urls.txt; open (LINKS, $file) or die Can't open $file: $!; We're fine up to here. chomp (@url = read(LINKS, $url, 100)); Let's break that into two steps: my @urls = LINKS;

Re: foreach (from a file)

2004-07-15 Thread James Edward Gray II
On Jul 15, 2004, at 10:56 AM, Brian Volk wrote: James, Thanks so much for your help, it's now working great! Happy to help. One question, if you don't mind... Sure. my @urls = LINKS; # slurp the file Is this telling the diamond operator what to use for input? You got it. Because we're

Re: not sure what I did ?

2004-07-15 Thread James Edward Gray II
On Jul 15, 2004, at 3:34 PM, Brian Volk wrote: This script was running just fine before I changes the files in the directory handle. What I don't understand is why the file names are showing up when I run the script very confused. I'm betting that test file directory isn't the same one

Re: $^T inconsistant?

2004-07-14 Thread James Edward Gray II
On Jul 14, 2004, at 2:27 PM, perl.org wrote: I would like to use them if just for documentation purposes - it is just slightly more clear to me to see sub something( $$$ ) { than sub something { In Perl, we write that: sub something { my($param1, $param2, $etc) = @_; # }

Re: $^T inconsistant?

2004-07-14 Thread James Edward Gray II
On Jul 14, 2004, at 2:50 PM, perl.org wrote: This does kindof make me laugh though: Alphanumerics have been intentionally left out of prototypes for the express purpose of someday in the future adding named, formal parameters Sorry in advance to anyone who will inform me that's copyrighted

Re: $^T inconsistant?

2004-07-14 Thread James Edward Gray II
On Jul 14, 2004, at 3:18 PM, perl.org wrote: OK, unless I'm missing something, I will only prototype my functions, not the legacy code here. We're trying to teach you Perl. Please remember that. It's why you are here. Most of us Perl users aren't big on prototyping. As far as I'm concerned,

Re: $^T inconsistant?

2004-07-14 Thread James Edward Gray II
On Jul 14, 2004, at 3:39 PM, perl.org wrote: On Wed, 14 Jul 2004 15:31:00 -0500, James Edward Gray II wrote We're trying to teach you Perl. Please remember that. It's why you are here. This sure can be an unfriendly list... That was my Nice Voice, actually. Ask the list. I ran off some guy

Re: Reading a variable file name

2004-07-13 Thread James Edward Gray II
On Jul 13, 2004, at 8:31 AM, [EMAIL PROTECTED] wrote: Greetings, Howdy. Would someone be kind enough to point me in the right direction to solve this problem? I'll sure try. An application creates XML files in a subdirectory, which I then convert to EDI. That part is now working fine. My

Re: sub naming conventions

2004-07-13 Thread James Edward Gray II
On Jul 13, 2004, at 6:52 PM, perl.org wrote: Is there an established, documented best practice for naming subroutines in Perl? does it differ whether the subroutine is in a script or a module (I would like it to be clear in my scripts whether I am expecting something local or packaged). I

Re: Split the line with | character

2004-07-06 Thread James Edward Gray II
On Jul 6, 2004, at 4:09 PM, Wil wrote: Dear Folks, I'm trying to split a line that contains a pipe | and I cann't find a way how to do it. If i put a back slash \, it doesn't work either. Can somebody help me how to do it? There's really nothing wrong with your code, so the problem is something

Re: __DATA__ Token Problem

2004-07-05 Thread James Edward Gray II
On Jul 5, 2004, at 2:57 PM, Jan Eden wrote: 2. Is it possible to change to content of what the handle so that the __DATA__ Sektion of my skript changes? I don't think it's a good idea to have a script write to itself. The DATA section is meant to keep static input out of the way of your processing

Re: Socket or NetServer::generic???

2004-06-30 Thread James Edward Gray II
On Jun 30, 2004, at 3:49 AM, Bastian Angerstein wrote: Hello, there I am progarmming a client server passed solution. My Question here ist which Modul I should use. I already noticed that the IO::Socket and the NetServer::Generic are both easy to use. My question is does a IO::Socket server handle

Re: string seperated by multiple spaces

2004-06-28 Thread James Edward Gray II
On Jun 28, 2004, at 10:19 AM, Naser Ali wrote: Hello all, I have a line of text and numbers each seperated by multiple or single spaces looks like this abc 123 33545 789 I wanted to split the above line and store each column value in a specific variable and later print, Below is the

Re: string seperated by multiple spaces

2004-06-28 Thread James Edward Gray II
On Jun 28, 2004, at 11:15 AM, Naser Ali wrote: Below is the actual code. This is just the preliminary code to test the logic, it is not final yet, therefore, I am not using Warnings, Strict or for that matter anything else. It's easy to make excuses, harder to do the right thing. Help us help

Re: string seperated by multiple spaces

2004-06-28 Thread James Edward Gray II
On Jun 28, 2004, at 11:32 AM, Michelle Rogers wrote: wow..somebody woke up on the wrong side of bed, this morning... I wish I could say I was sorry. ;) You think whatever you want of me, but I'm not wrong. I've tried telling the person who started this thread before. Now I'm trying something

Re: string seperated by multiple spaces

2004-06-28 Thread James Edward Gray II
On Jun 28, 2004, at 11:37 AM, MCMULLIN, NANCY wrote: After all, I thought the name of this group was Perl BEGINNERS... Sure is. And the FIRST thing beginners need to learn is to add strict and warnings to help them learn. It also helps us read your code, which can only be good for you. James

Re: string seperated by multiple spaces

2004-06-28 Thread James Edward Gray II
On Jun 28, 2004, at 11:55 AM, Naser Ali wrote: But on the other hand there are people on the list like Mr. James Edward Gray II has some ego problems. No body asked you to answer my question. if you really think beginners like me, for whom this list was created in the first place

Re: Creating images

2004-06-26 Thread James Edward Gray II
On Jun 25, 2004, at 5:56 PM, dan wrote: Hi all, again! I'm attempting to make a web page, where all the buttons are dynamic, where dynamic I say there's 1 template button image with nothing written on it, and I want to put requests into a html page to call a script as an image to put text on

Re: Execute a sub: $sub

2004-06-25 Thread James Edward Gray II
On Jun 24, 2004, at 11:55 PM, Daniel Kasak wrote: Hi all. I have an object that I want to have execute some code that it gets told about when it's constructed. How do I go about that? ie: $self-{some_code_to_execute} will either have the name of a sub, or a reference to a sub, or something. I

Re: Printing outside of foreach...

2004-06-25 Thread James Edward Gray II
On Jun 24, 2004, at 11:52 PM, Daniel Falkenberg wrote: Hello again, The folling code takes some data from the Australian Stock Exchage website. The problem I am having is that I need to be able to access the hash of the hash outside of the foreach statement. So in other words I would like to be

Re: Perl script

2004-06-25 Thread James Edward Gray II
On Jun 25, 2004, at 2:49 AM, Jame Brooke wrote: #!/usr/bin/perl [snip code] I have few question regarding code above, 1. what the function for if ( $ARGV[0] =~ /^-([udm])$/ ) { $type = $1; shift @ARGV; } convert(@ARGV); It's grabbing the command line switches, crudely. Better would be to

Re: Printing hash outside of foreach loop

2004-06-25 Thread James Edward Gray II
On Jun 25, 2004, at 10:12 AM, Daniel Falkenberg wrote: Hi Wiggins, Thank you for your reply. I will go and use the Finance::Quote::ASX module. For now though this problem is really bugging me and for my own sake I would like to get it to work. I have declared all my variables and am using

Re: Perl and Excel

2004-06-25 Thread James Edward Gray II
On Jun 25, 2004, at 10:44 AM, Naser Ali wrote: Hello All, Is there a way to move data from flat file to Excel spread sheet using perl? Definitely. Take a trip over to the CPAN. You're looking for the module, Spreadsheet::WriteExcel. Or, sometimes when I'm in a hurry and I don't need

Re: A possibly stupid 'Perl' question?

2004-06-25 Thread James Edward Gray II
On Jun 25, 2004, at 1:25 PM, u235sentinel wrote: I haven't used it myself however I understand there is Active Perl for Windows available. I don't have any details but perhaps you could google for it or someone here could give you directions. No need to do this as it is available from

Re: Timer in Perl??

2004-06-24 Thread James Edward Gray II
On Jun 24, 2004, at 9:33 AM, William Martell wrote: Hello Group, Could anyone please tell me if there is a timer function in Perl. I am trying to get some perl code to run every morning, but I am unsure how to do it. You could always sleep() for a day between runs, but that seems far too

Re: Quoting a scalar in a substitution

2004-06-23 Thread James Edward Gray II
On Jun 23, 2004, at 11:23 AM, Richard Barrett-Small wrote: Hello all, Howdy. Will really appreciate help with this: I'm pulling my hair out with this one. I have a list of contents in the @contents array and the script finds those headings in the html and adds anchors to them. The trouble is,

Re: pattern matching

2004-06-23 Thread James Edward Gray II
On Jun 23, 2004, at 12:34 PM, [EMAIL PROTECTED] wrote: Hi, I have a string similar to: Comment: FILING --- - This is read in as one line (with the page feed). I was trying to whatever follows the words and I tried

Re: pattern matching

2004-06-23 Thread James Edward Gray II
(Let's keep our discussion on the list for all to see.) On Jun 23, 2004, at 12:44 PM, [EMAIL PROTECTED] wrote: Let's try to get a little simpler with our approach. Does this grab what you need? m/(\W+)$/ James What a quick response. Thanks. No problem. I assume you mean do this? Am I right?

Re: pattern matching

2004-06-23 Thread James Edward Gray II
On Jun 23, 2004, at 12:59 PM, [EMAIL PROTECTED] wrote: OK. I am reading a file. This line is at the bottom of the file and the ---** is a sign that the section is complete. This may be a sign that you aren't reading the file in the easiest possible way. I wonder if setting the

Re: how to sort certain pattern from a file

2004-06-22 Thread James Edward Gray II
On Jun 16, 2004, at 2:25 PM, Naser Ali wrote: Thanks James, I totally agree with you and appreciate your comments. I was going to refine the whole code by putting in better logic, naming convention, and error handling. I just posted the code baically to share the basic logic of handling the

Re: how to sort certain pattern from a file

2004-06-16 Thread James Edward Gray II
On Jun 16, 2004, at 12:22 PM, Naser Ali wrote: Hello All, Hello. Yesterday I posted a question asking if anyone can suggest a way of accomplishing this. In the mean while I have comeup with a quick and dirty way of processing the data file and sorting it in an array. Once it is sorted, then, I

Re: How to open a file for read as well as write

2004-06-15 Thread James Edward Gray II
On Jun 15, 2004, at 5:48 AM, Ramprasad A Padmanabhan wrote: I want to open a file using a perl script and change a particular variable in it. I think by setting the $^I variable I can open a file for read and write, But I am not getting any examples anywhere You CAN open a file for read and write,

Re: How to open a file for read as well as write

2004-06-15 Thread James Edward Gray II
On Jun 15, 2004, at 10:02 AM, Ramprasad A Padmanabhan wrote: No that is not what I wanted I found that out anyways thanks Want to bet? Guess how the code you posted works, behind the scenes. ;) Seriously, I'm glad you found your answer. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Is an Array

2004-06-15 Thread James Edward Gray II
On Jun 15, 2004, at 2:24 PM, Angie Ahl wrote: Hi Howdy. Scouring the books to try and find this, but it's evading me. How can I test whether something is an array. For some definition of something that includes references, use ref(). :) ie I have a hash and some values are anon arrays and some

Re: Elegant quoted word parsing

2004-06-11 Thread James Edward Gray II
On Jun 10, 2004, at 9:46 PM, Beau E. Cox wrote: Hi - I am trying to come up with a simple, elegant word parsing script, that: * takes a scalar string, and * splits it into words separating on white space, commas, and a set of delimiters: '' // () {} [] ##, and * returns the array of words.

Re: parsing records

2004-06-10 Thread James Edward Gray II
On Jun 10, 2004, at 8:13 AM, Virmani, Amit (GMI Debt Technology) wrote: I am a novice in Perl... I have a file with records of fields in double quotes separated by commas, for example: abc,123xyz,Test 1,Test 2,100,000... What you describe is the CSV file format and there's really no good reason

Re: Installing the libwww-perl module on Mac os X 10.3.2

2004-06-10 Thread James Edward Gray II
On Jun 10, 2004, at 9:39 AM, Phil Calvert wrote: OK, after poking around a bit it seems that the the developer tools need to be installed. Having done that I now get this after running the line perl -MCPAN -e 'CPAN::install LWP' Try: sudo perl -MCPAN -e 'install LWP' You'll need to give the

Re: Installing the libwww-perl module on Mac os X 10.3.2

2004-06-10 Thread James Edward Gray II
On Jun 10, 2004, at 11:15 AM, Phil Calvert wrote: Hello, Thanks for the reply. When I try that I get; Can't locate object method install via package LWP at -e line 1. I should also say that I tried sudo perl -MCPAN -e 'CPAN::install LWP' and got the result that I reported previously. You might

Re: Have you seen this error before?

2004-06-10 Thread James Edward Gray II
On Jun 10, 2004, at 12:36 PM, jason corbett wrote: I am getting the error: ARRAY(0x1024df4) It's not an error. It's what you see when you try to print an array reference. This line is where it's coming from: print $record\n; If you wanted to see what's in the array referenced by $record, try:

Re: Have you seen this error before?

2004-06-10 Thread James Edward Gray II
On Jun 10, 2004, at 12:56 PM, jason corbett wrote: Thanks for the advice. No problem. What is best for selecting records from a database: Hash or Array? Array if you want to walk it be index, hash if you want to walk it by name. There is no best. ;) James -- To unsubscribe, e-mail: [EMAIL

Re: Have you seen this error before?

2004-06-10 Thread James Edward Gray II
Let's keep our discussions on the list, so we can all help and learn. On Jun 10, 2004, at 1:15 PM, jason corbett wrote: This statement  ( print %record}.\n; print %record}.\n; )  from my script below keeps giving the error use of uninitialized value in list argument at filename line ##, STDLIN

Re: regular expression

2004-06-09 Thread James Edward Gray II
On Jun 9, 2004, at 6:46 PM, Mandar Rahurkar wrote: Hi, I am looking for URL's that end in .html OR .htm or / $URL =~ m/(?:\.html?|\/)$/ That should do it. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: splitting with special characters

2004-06-03 Thread James Edward Gray II
On Jun 3, 2004, at 8:11 AM, Singh, Ajit p wrote: Hello All, I am trying to split a string with the / ( forward slash) as the marker. $mystring = abcde/fghi split (///,$mystring) -- gives me compile error split (/\//,$mystring) -- gives me abcdefghi I hope not. The second one is fine: perl -e

Re: Loading Scalar Vars with Text - Readability

2004-06-01 Thread James Edward Gray II
On Jun 1, 2004, at 2:16 PM, PerlDiscuss - Perl Newsgroups and mailing lists wrote: Hi, Adding Perl to the list of languages... and came across a question of loading vars with very long strings... Actually I am modifiying a prior employee's code and want to make it more readable.

Re: I am looking for PERL coder from Romania, Bulgaria, Russia or India

2004-06-01 Thread James Edward Gray II
On Jun 1, 2004, at 8:07 PM, Maxipoint Rep Office wrote: I am looking for PERL coder from Romania, Bulgaria, Russia or India for long terms relationship. Then look in the right place. ;) Somewhere like: http://jobs.perl.org/ This is a mailing list where beginners can ask questions and get help

Re: [Socket Programming]: Need info for Client / Server scenario

2004-05-31 Thread James Edward Gray II
On May 30, 2004, at 11:06 PM, [EMAIL PROTECTED] wrote: Hi, Howdy. I need some good links for understanding socket programming (Client / Server programming). Not a link specifically, but I feel I would be letting you down if I didn't mention Network Programming with Perl. That is an excellent

Re: [Socket Programming]: Need info for Client / Server scenario

2004-05-31 Thread James Edward Gray II
On May 31, 2004, at 11:10 AM, [EMAIL PROTECTED] wrote: Hi James, Can you suggest me what this POE is? POE or Perl Object Environment is a multitasking framework. Where can I get info regarding this? http://poe.perl.org/ James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: regular expression

2004-05-28 Thread James Edward Gray II
On May 28, 2004, at 8:31 PM, Mandar Rahurkar wrote: Hi, I am trying to remove from file : 1. all characters but any alphabet and numbers. tr/A-Za-z0-9//cd; # should handle that 2. all trailing spaces should be made to one space. I'm not 100% sure I understand this, but I'm

Re: array population from system app call

2004-05-25 Thread James Edward Gray II
On May 25, 2004, at 12:45 PM, [EMAIL PROTECTED] wrote: All, was hoping anyone could provide some syntax help. I want to populate an array from a system app call like so and then print out each element. my @ftapes = system (evmvol -w label_state=3|grep barcode); print $ftapes[0]; You're looking

Re: array population from system app call

2004-05-25 Thread James Edward Gray II
On May 25, 2004, at 1:03 PM, [EMAIL PROTECTED] wrote: cool, but why doesn't my @ftapes = system (evmvol -w label_state=3|grep barcode); print $ftapes[0] OR print $ftapes[0,1] work? Because system() does not return the program's output, it returns exit status. I see that it does not support

Re: array population from system app call

2004-05-25 Thread James Edward Gray II
On May 25, 2004, at 1:34 PM, [EMAIL PROTECTED] wrote: ok so now I can get all elements printed using my @ftapes = ( ); my @ftapes = `evmvol -w label_state=3|grep barcode`; foreach $_ (@ftapes) { print $_ , \n; } so now I want to use

Re: array population from system app call

2004-05-25 Thread James Edward Gray II
On May 25, 2004, at 2:24 PM, [EMAIL PROTECTED] wrote: here is the sample output. barcode=E01124 barcode=E01178 barcode=E01195 barcode=E01225 barcode=E01232 maybe I am not understanding when a multidimensional array would be useful? when are these references useful? I really doubt you need a

Re: array population from system app call

2004-05-25 Thread James Edward Gray II
On May 25, 2004, at 2:45 PM, [EMAIL PROTECTED] wrote: James, yes it does thanks! Will you be so kind and answer my other question too? Good news. Yes, I will... maybe I am not understanding when a multidimensional array would be useful? when are these references useful? is there a perldoc I

Re: get hash from array

2004-05-24 Thread James Edward Gray II
On May 24, 2004, at 7:46 AM, [EMAIL PROTECTED] wrote: sub xpto { my %a = map {$_ = undef} (@_); return \%a; } or sub xpto { return {map {$_ = undef} (@_)}; } I'm using this code but shall exist someting clearner without map. Can you help me? I find map() to be the ideal solution. That's

Re: get hash from array

2004-05-24 Thread James Edward Gray II
On May 24, 2004, at 8:06 AM, [EMAIL PROTECTED] wrote: I had the idea that something like: sub xpto { my %a; [EMAIL PROTECTED] = (); @[EMAIL PROTECTED] = (); return \%a; } should work. Make the inline change above and it will. James Obviuslly this idea will be used in major subroutines.

Re: public/private variables, accessor functions question

2004-05-20 Thread James Edward Gray II
On May 20, 2004, at 8:32 AM, Graeme McLaren wrote: Hi, I'm starting to look at OO in PERL, I've written a working class but I don't know how to implement private and public variables and accessor functions, any idea how to do that? Perl takes a very lax view on the whole security issue of

Re: regex string modification

2004-05-20 Thread James Edward Gray II
On May 19, 2004, at 7:21 PM, meb wrote: My regex looks something like this: (Save 1st 20 words): /^(\w|\W){20}/g ^ matches only at the beginning of the string while the /g modifier tries to create a global search matching all occurrences. Matching all of what can only be in one place is

  1   2   3   4   5   6   7   8   >