Re: Putting file content into an array

2006-07-20 Thread hridyesh pant
Suggestion given by "[EMAIL PROTECTED]", Sayed, Irfan; your questions are *too basic*. Any Perl programmer who has read the first seven documents referred by "perldoc perl" will know the questions you're asking. Please read these: perldoc pe

Re: Putting file content into an array

2006-07-20 Thread Chad Perrin
On Fri, Jul 21, 2006 at 02:24:00PM +0800, Sayed, Irfan (Irfan) wrote: > Hi, > > I need to read a specific file and put the each line of that file into > an array. > > I mean first line will go to the first position of the array , second > line shud go to the second position of the array and so

RE: Putting file content into an array

2006-07-20 Thread Krishnakumar K P
open(FILE, $filename); @array = ; close(FILE); -Original Message- From: Sayed, Irfan (Irfan) [mailto:[EMAIL PROTECTED] Sent: Friday, July 21, 2006 11:54 AM To: Perl Beginners Subject: Putting file content into an array Hi, I need to read a specific file and put the each line of tha

Putting file content into an array

2006-07-20 Thread Sayed, Irfan \(Irfan\)
Hi, I need to read a specific file and put the each line of that file into an array. I mean first line will go to the first position of the array , second line shud go to the second position of the array and so on. How do i do that ? Please let me know. Regards Irfan.

Re: get only filenames and not directory names under a specific path.

2006-07-20 Thread Edi STOJICEVIC
Le jeu, jui 20, 2006 at 09:36:02 -0700, Nishi Bhonsle a tapoté sur son clavier : > Hi: > I am starting a new thread based of an older thread just because there was a > lot of different things that were requested for and it had gotten a bit > confusing. > > I got a lot of help from all you experts

get only filenames and not directory names under a specific path.

2006-07-20 Thread Nishi Bhonsle
Hi: I am starting a new thread based of an older thread just because there was a lot of different things that were requested for and it had gotten a bit confusing. I got a lot of help from all you experts to write the below code that takes an argument path C:\build\Sample\NewDir that contains--

Re: Polluting the Global Namespace

2006-07-20 Thread Mumia W.
On 07/20/2006 05:09 AM, Shane Calimlim wrote: I'd like to add some sub routines to the global namespace. I know this is usually considered bad design for modules, but I intend to do this only for a personal project. I'd just like to know if this is possible, and how. And if so, using pure perl c

Re: Polluting the Global Namespace

2006-07-20 Thread Aaron Priven
See "perldoc Exporter". If you use @EXPORT instead of @EXPORT_OK, it will put those subroutines into the global namespace by default. On Jul 20, 2006, at 3:09 AM, Shane Calimlim wrote: I'd like to add some sub routines to the global namespace. I know this is usually considered bad design fo

Create Snapshot of website

2006-07-20 Thread Mike Blezien
Hello, I been trying to research the feasibility of using Perl and/or special module(s) that can capture a website page and create a "snapshot" of the website page, or like a thumbnail image. I've seen this done, but not sure if it can be done using Perl or Perl modules. if anyone on the lis

RE: print statement error

2006-07-20 Thread Timothy Johnson
It works for me, but it sounds like '[A-Z][a-z]+' might not be doing what you think. That says "One upper-case letter followed by one or more lower-case letters." I can see one problem with that right now. I live in Santa Clara, which won't match because it has a space in it. But this matched:

print statement error

2006-07-20 Thread Ryan Dillinger
Hello All, I have here a script, which all runs well with the exception of the: print "value looks like a city, state, and zip code.\n";. I can type in Upper or Lowercase letters in any combination along with the zip, but I still get the error: "I couldn't figure out what that value is. Can you

sorting a nested array?

2006-07-20 Thread Alan Campbell
ello folks, ...got a bit carried away with references & deeply nested structures. Net result is I have an array of the form: - $ref<- reference to nested array [0] <- nothing at this level to key/sort on [0]

RE: array help

2006-07-20 Thread Timothy Johnson
-Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 4:18 PM To: beginners@perl.org Subject: Re: array help >> my @test = ("/test" , "/playground"); >> print @test; >> >> >> >> i need the output in following fasion >> >> /test >> /playground >> >> can

Re: array help

2006-07-20 Thread Dr.Ruud
"Sayed, Irfan (Irfan)" schreef: > I have written following line. but i am getting error Which error? > my @test = ("/test" , "/playground"); > print @test; > > i am getting output as follows > > /test/playground > > i need the output in following fasion > > /test > /playground > > can you plea

Polluting the Global Namespace

2006-07-20 Thread Shane Calimlim
I'd like to add some sub routines to the global namespace. I know this is usually considered bad design for modules, but I intend to do this only for a personal project. I'd just like to know if this is possible, and how. And if so, using pure perl code or would I have to delve into xs?

Re: check existence of element in a list

2006-07-20 Thread joseph
"Rob Dixon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > joseph wrote: > > > > "Rob Dixon" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >>joseph wrote: > >> > >>>I need help with my script, this supposedly would check a workstation > >>>listed in one file

Re: CGI, IIS and pack

2006-07-20 Thread Tom Phoenix
On 7/20/06, Jay Savage <[EMAIL PROTECTED]> wrote: Perl 5.00502 Invalid type in pack: '(' at my $classpack = "N2 A128 N2 A64 A64 (N3 A)15"; I don't think parentheses were supported in pack() formats until a more recent version of Perl; check your documentation to be sure. Hope this

Re: CGI, IIS and pack

2006-07-20 Thread Todd W
""Jay Savage"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can anyone point me to where I've gone wrong? Or is this a server > quirk, which we seem to have plenty of (for instance, "-w" works fine > in the shebang, but "use warnings" can't find warnings.pm)? That means it is

CGI, IIS and pack

2006-07-20 Thread Jay Savage
I'm stumped here. I have the following lines of code. They work as expected on my workstations. They work fine in Komodo's debugger with "Emulate CGI" turned on. But when I put the script on our server--NT 4.0/IIS 4/Perl 5.00502 (I know, I know, but I don't maintain it)--CGI::Carp carps: Inval

RE: Object oriented programming with perl

2006-07-20 Thread Shourya Sengupta
Thanks a lot Joshua and Timothy. This was exactly what I was looking for. Your responses will help me a lot. Regards, Shourya -Original Message- From: Joshua Colson [mailto:[EMAIL PROTECTED] Sent: Friday, July 21, 2006 12:57 AM To: Shourya Sengupta Cc: beginners@perl.org Subject: RE: Ob

RE: Object oriented programming with perl

2006-07-20 Thread Joshua Colson
On Thu, 2006-07-20 at 12:19 -0700, Timothy Johnson wrote: > I think it might be clearer if you checked this doc: > > perldoc lib > > Which has a good explanation of using 'use lib' to define directories to > search for modules. Thank you Timothy. I was looking for that document (admittedly, not

RE: how to add a list of numbers

2006-07-20 Thread Charles K. Clarkson
tom arnall wrote: : Whatever happened to good old: : : my (@data,$result); Why declare these ... : @number = (1,2,3); : $sum = 0; And then use these? Go ahead. Hit yourself upside the head. :) Yet another reason to declare variables only as they are first

RE: Object oriented programming with perl

2006-07-20 Thread Joshua Colson
On Fri, 2006-07-21 at 00:36 +0530, Shourya Sengupta wrote: > > Hi Joshua, > Can you make it a bit clear? Assuming you've written a perl module (class) called 'Widget::Factory' the actual code should be in a file called 'Widget/Factory.pm' (assuming a UNIX like system). Lets further assume that th

RE: Object oriented programming with perl

2006-07-20 Thread Timothy Johnson
I think it might be clearer if you checked this doc: perldoc lib Which has a good explanation of using 'use lib' to define directories to search for modules. -Original Message- From: Shourya Sengupta [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 12:07 PM To: Joshua Colson Cc

RE: how to add a list of numbers

2006-07-20 Thread Timothy Johnson
-Original Message- From: tom arnall [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 12:08 PM To: beginners@perl.org Subject: Re: how to add a list of numbers > > > Whatever happened to good old: > > my (@data,$result); > @number = (1,2,3); > $sum = 0; > f

RE: Object oriented programming with perl

2006-07-20 Thread Shourya Sengupta
Hi Joshua, Can you make it a bit clear? Thanks, Shourya -Original Message- From: Joshua Colson [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 9:59 PM To: Shourya Sengupta Cc: beginners@perl.org Subject: Re: Object oriented programming with perl On Thu, 2006-07-20 at 15:40 +053

Re: how to add a list of numbers

2006-07-20 Thread tom arnall
On Friday 14 July 2006 11:00 pm, I BioKid wrote: > is there any shortest way to add a list of random numbers ? > for example : > 11 > 1 > 250 > 39 > 100 Whatever happened to good old: my (@data,$result); @number = (1,2,3); $sum = 0; foreach(@number) {

Recall: array help

2006-07-20 Thread Sayed, Irfan \(Irfan\)
Sayed, Irfan (Irfan) would like to recall the message, "array help".

Creating an array of hashes from a database while preserving order

2006-07-20 Thread Derek Ash
I am creating a phone directory and would like to display the entire contents of the database ordered by last name utilizing the HTML:Template module. I am not sure the code that I have so far will work as I have planned as this is my first time ever using an array of hashes. How can I be sure, u

Re: array help

2006-07-20 Thread Chad Perrin
On Thu, Jul 20, 2006 at 10:51:58PM +0800, Sayed, Irfan (Irfan) wrote: > Hi, > > I have written following line. but i am getting error > > my @test = ("/test" , "/playground"); > print @test; > > i am getting output as follows > > /test/playground > > i need the output in following fasion

Re: array help

2006-07-20 Thread Maxim
Hi, Use foreach smth like foreach $i (@test) { print "$i\n"; } On Thu, Jul 20, 2006 at 10:51:58PM +0800, Sayed, Irfan (Irfan) wrote: > Hi, > > I have written following line. but i am getting error > > my @test = ("/test" , "/playground"); > print @test; > > i am getting

Re: array help

2006-07-20 Thread Hal Wigoda
#!/usr/bin/perl my @test = ("/test" , "/playground"); print @test; print "\n"; print @test[0],"\n"; print @test[1],"\n"; you must print each array item with a \n On Jul 20, 2006, at 9:33 AM, Sayed, Irfan ((Irfan)) wrote: Hi, I have written following line. but i am getting error my @test =

array help

2006-07-20 Thread Sayed, Irfan \(Irfan\)
Hi, I have written following line. but i am getting error my @test = ("/test" , "/playground"); print @test; i am getting output as follows /test/playground i need the output in following fasion /test /playground can you please tell me what is wrong? Regards Irfan.

RE: Rel help in array

2006-07-20 Thread Sayed, Irfan \(Irfan\)
sorry I didn't get anything can u please give some codeline. regards irfan. -Original Message- From: Wagner, David --- Senior Programmer Analyst --- WGO [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 10:39 PM To: Sayed, Irfan (Irfan); Perl Beginners Subject: RE: Rel help in ar

RE: Rel help in array

2006-07-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Sayed, Irfan (Irfan) wrote: > Hi, > > I have one array called as @array1 which has some data > > I have another @array2 which also has some data. > > now for each element / value of both these arrays i need to a run a > specific command at a time , not one by one. means that for every > element

Rel help in array

2006-07-20 Thread Sayed, Irfan \(Irfan\)
Hi, I have one array called as @array1 which has some data I have another @array2 which also has some data. now for each element / value of both these arrays i need to a run a specific command at a time , not one by one. means that for every element of both these arrays i have to run specifi

Re: array help

2006-07-20 Thread Hal Wigoda
you have to add a "\n" between the 2 elements in the array. On Jul 20, 2006, at 9:51 AM, Sayed, Irfan ((Irfan)) wrote: Hi, I have written following line. but i am getting error my @test = ("/test" , "/playground"); print @test; i am getting output as follows /test/playground i need the o

RE: array help

2006-07-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Sayed, Irfan (Irfan) wrote: > Hi, > > I have written following line. but i am getting error > > my @test = ("/test" , "/playground"); > print @test; > > i am getting output as follows > > /test/playground > > i need the output in following fasion > > /test > /playground > > can you please t

array help

2006-07-20 Thread Sayed, Irfan \(Irfan\)
Hi, I have written following line. but i am getting error my @test = ("/test" , "/playground"); print @test; i am getting output as follows /test/playground i need the output in following fasion /test /playground can you please tell me what is wrong? Regards Irfan.

Re: Autovivification / anonymous array questions

2006-07-20 Thread Tom Phoenix
On 7/20/06, Brian Volk <[EMAIL PROTECTED]> wrote: } elsif (/^s+(\S.*)/) { # a provision That pattern begins by matching an 's' at the start of the line, but that's not what you want. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Object oriented programming with perl

2006-07-20 Thread Joshua Colson
On Thu, 2006-07-20 at 15:40 +0530, Shourya Sengupta wrote: > Suppose the package is installed in a different path. > Can we then mention the full path of the package in statesments like > this? eg > > use perldoc -q lib hint: 'use lib...' -- Joshua Colson <[EMAIL PROTECTED]> -- To unsubscr

Object oriented programming with perl

2006-07-20 Thread Shourya Sengupta
In a particular perl program if we want to declare objects of a class we have to include the class at the top of the program like use The perl interpreter by default searches for the package in a specific path. (in perl/lib) Suppose the package is installed in a different path. Can we then me

Re: Autovivification / anonymous array questions

2006-07-20 Thread Rob Dixon
Brian Volk wrote: > > I have a couple of questions from chapter 4 in the Alpaca book. > > Everything is working fine but I keep getting "I don't understand > blue_shirt" whether I create the anonymous array w/ > > $provisions{$person} = [] unless exists $provisions{$person}; > > Or if I comment ou

xml::simple declartion missed

2006-07-20 Thread Ken Perl
hi, The code's output doesn't include the xml declaration , how to fix the issue in the program? use XML::Simple; my $cust_xml = XMLin('./customers.xml', forcearray=>1,KeepRoot=>1); for my $customer (@{$cust_xml->{customer}}) { # Capitalize the contents of the 'first-name' and 'surname' elemen

RE: write out filenames of files existing on a filesystem into afile

2006-07-20 Thread Venkat Saranathan
Nishi, Parsing XML with your own logic is cumbersome. However, you can easily parse it using Xml::Parser/Xml::Simple modules. Here is a sample code using Xml::Simple... use strict; use XML::Simple; my ($parser, $xmldata); $parser = XML::Simple->new(); $xmldata = $parser->XMLin($ARGV[0]);

Autovivification / anonymous array questions

2006-07-20 Thread Brian Volk
Hello~ I have a couple of questions from chapter 4 in the Alpaca book. Everything is working fine but I keep getting "I don't understand blue_shirt" whether I create the anonymous array w/ $provisions{$person} = [] unless exists $provisions{$person}; Or if I comment out the above l

Re: non fixed number of properties in constructor

2006-07-20 Thread Ken Perl
I almost got the ideas with all your replies, thanks. On 7/20/06, D. Bolliger <[EMAIL PROTECTED]> wrote: Hi Ken Ken Perl am Mittwoch, 19. Juli 2006 12:04: > ok, let me explain what I mean. Better done by inline/bottom posting, if you already got a bottom answer :-) > $account = new Account; >

Re: write out filenames of files existing on a filesystem into afile

2006-07-20 Thread Jay Savage
On 7/19/06, Prabu <[EMAIL PROTECTED]> wrote: Nishi Bhonsle wrote: > Hi: > > How do I look for the string in the following file > so that > i can insert something between the tags > > insert some bla text here > > in the following file? > > -

Re: Module to parse CSV string

2006-07-20 Thread Chap Harrison
On Jul 20, 2006, at 1:30 AM, Todd W wrote: Theres also Text::CSV_XS which is configurable (and faster than Text::CSV). Specifically, note the quote_char and escape_char arguments to the constructor... So there is - thanks! I discovered that one record has a field containing \r, which CSV_