Is there a simple search and replace command I can do to remove all
the newline characters from a string? (besides splitting the string
based on \n and then joining the elements)
This seems pretty basic but the below commands don't seem to work:
s/\\n//g
s/\n//g
--
To unsubscribe, e-mail: begi
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 Oct 26, 3:51 am, [EMAIL PROTECTED] (Jeff Pang) wrote:
> using a regex is may suitable.
>
> $ perl -e '$x= "a;b;c;d;e;f;g;h";@re=$x=~/(\w+;\w+);{0,1}/g;print "@re"'
> a;b c;d e;f g;h
>
> On 10/26/07, Mahurshi Akilla <[EMAIL PROTECTED]> wrot
Is there an easy way (without writing our own proc) to split a string
based on number of occurances of a character ?
for example:
$my_string = "a;b;c;d;e;f;g;h"
@regsplitarray = split (/;/, $my_string) splits based on every 1
occurance of ";"
what if i want it to do 2 at a time ? e.g. $regsp
is there an easy way (without iterating through the array) to get a
specified column out of a 2d array?
lets say i have
@array2d
1 2 3 4
5 6 7 8
what i am looking for is something like
@my2ndcolum = // magic //
i know you can get it with rows using ( $my2ndrowref = @array[1] ) but
i don't wa
is there an easy way to get the average and standard deviation in perl
(given an array of numbers). i don't want to reinvent the wheel and
write my own functions.
i saw something for the average (see below). it works fine. is there
a similar quickie for std deviation (or perhaps, the median)
us
would be nice to know if this
can be done.
Mahurshi Akilla
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
EMAIL PROTECTED]
Have you tried perl -d switch ?
Read about perl debuggers here: http://debugger.perl.org/
Mahurshi Akilla
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
If you're trying to split a long string into smaller strings of 60
characters each, you can take a look at the substr function and build
a loop around it.
http://www.perlmeme.org/howtos/perlfunc/substr.html
Mahurshi Akilla
On Sep 4, 5:29 am, [EMAIL PROTECTED] (Pedro Soto) wrote:
> Hi,
&g
I am trying to read a csv file into a 2D array matrix
I am having a hard time trying to get the array returned by split
function to "attach" to a 2D array.
See the code below for further info on what I'm trying to do
## initialize
$row = 0;
$col = 0;
## go thru each line of file
while () {
Does anyone know if there's a perl script available that can run a
simple forum? I tried searching on google but any combination of
"perl" and "forum" in the search words are giving me results on perl
forums :-) but not the forums being run by perl.
Thanks
--
To unsubscribe, e-mail: [EMAIL PRO
11 matches
Mail list logo