On 10/28/07, yitzle <[EMAIL PROTECTED]> wrote:
snip
> Arrays can be set from lists and arrays get converted to lists all the time.
> Is there any practical difference? (Other than the fact that an array
> has a reference which can be passed as a scalar?)
snip
There are several key differences and
On Sunday 28 October 2007 16:13, Jo for Groups and Lists wrote:
> What I want are these array members from a string in a database. I'm
> almost there, just need to strip off the trailing pipe, but I am
> getting empty members too, so will have to test for that and dump the
> empty ones before proce
On 10/29/07, Tom Phoenix <[EMAIL PROTECTED]> wrote:
> An array is the kind of variable which holds
> a list; a list is the kind of data which is stored in an array. You
> can use the list contained in an array, and you can store a list into
> an array. But the array is the container, and the list
On 10/28/07, yitzle <[EMAIL PROTECTED]> wrote:
> Arrays can be set from lists and arrays get converted to lists all the time.
It's more accurate to say that an array in Perl is always an array
*variable*. Whenever you read the word array, imagine the word
"variable" after it, if that helps. A lis
That perldoc has said, a list is a value while an array is a variable.
so [EMAIL PROTECTED] get what you wanted but \(1,2,3) returns each elements'
reference.
also @array = (1,2,3) will convert a list to an array automatically,
and mysub(@array) will set an array as a list automatically.
and you
Oops. Duly noted.
Functions/Subs return lists, not arrays.
But then again, grep() takes a list, and not an array :)
Arrays can be set from lists and arrays get converted to lists all the time.
Is there any practical difference? (Other than the fact that an array
has a reference which can be passe
On 10/29/07, yitzle <[EMAIL PROTECTED]> wrote:
> split() returns an array.
split returns a list not an array.
perldoc -q 'What is the difference between a list and an array?'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
split() returns an array.
You can use the grep() function to filter an array based on a RegEx,
eg empty string (/^$/)
@arr2 = grep !/$^/, @arr1;
This will make @arr2 hold everything in @arr2 except empty elements.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EM
On 10/25/07, Chas. Owens <[EMAIL PROTECTED]> wrote:
>
> From the sound of it what you want is in-place-editing:
>
> #!/usr/bin/perl -i
>
> use strict;
> use warnings;
>
> while (<>) {
> s/this/that/
> }
>
> The code above will read in any number of files modifying "this" to
> "that" in each on
On 10/29/07, Paul Johnson <[EMAIL PROTECTED]> wrote:
> On Sun, Oct 28, 2007 at 02:43:20PM -, NewbeeUnix wrote:
>
> > Hello Friends,
> >
> > What are the best jobs in Perl?
>
The primary jobs for perl development I saw on jobs mailing list are
web application.
> I suspect that most
> people wh
What I want are these array members from a string in a database. I'm
almost there, just need to strip off the trailing pipe, but I am getting
empty members too, so will have to test for that and dump the empty ones
before proceeding. Is this the best solution? {No, we can't change the
database form
Thanks for the help. Yes, I was modifying the file in a unix
enviroment (msys). Printing \r\n instead of \n solve the problem.
Wikipedia has a nice article about this issue with some perl code for
modifying/adapting line-breaks between different operating systems :
http://en.wikipedia.org/wiki/Newl
On Sun, Oct 28, 2007 at 02:43:20PM -, NewbeeUnix wrote:
> Hello Friends,
>
> What are the best jobs in Perl?
- flaming newbies on mailing lists
- moaning about perl 6
- telling volunteers what they should be doing instead
- providing unhelpful answers to ambiguous questions
Or are you t
is there a way to get the "nth" column of a string in perl, similar to
awk '{print $col_no}' in awk ?
###
There are multiple ways, but here are two examples:
In the first example, split is what you need to pay attention to.
In the second example, @F is the key here.
On 10/28/07, Mahurshi Akilla <[EMAIL PROTECTED]> wrote:
> is there a way to get the "nth" column of a string in perl, similar to
> awk '{print $col_no}' in awk ?
snip
If I remember my awk correctly $col_no (e.g. $2) gives you the nth
space delimited field in the string (counting multiple spaces as
Mahurshi Akilla wrote:
>
> is there a way to get the "nth" column of a string in perl, similar to
> awk '{print $col_no}' in awk ?
AWK does not have a 'col_no' variable so what is it that you are trying
to do?
I assume that you meant:
awk '{print $2}'
which would print the second field of the
Hello Friends,
What are the best jobs in Perl?
Thnx!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
is there a way to get the "nth" column of a string in perl, similar to
awk '{print $col_no}' in awk ?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 10/27/07, sam <[EMAIL PROTECTED]> wrote:
> print "What Lesson are you on? ";
> chop($lesson = );
Although there's nothing really "wrong" wrong with that code, the use
of chop() instead of chomp() is antiquated. Are you reading a book
printed more than ten years ago? Maybe even a book about Per
Nigel Peck schreef:
> I've decided to write it from scratch, and could do with some
> help! [...]
> I can write regexes and have been working on parsing the bounces
> with them but I think I could do better using parsing techniques
> and modules that I don't understand right now.
>
> I've extracte
mAyur schreef:
> always escape '\' in double quotes like this "\\".
Inside single quotes or q{} too. Try for example:
perl -wle '
print q{\}
'
--
Affijn, Ruud
"Gewoon is een tijger."l
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://le
21 matches
Mail list logo