Aimee Cardenas wrote:
Ok, All,
Hello,
I'm a little confused. How does your outputs from die and print differ
when you put either $! or $? at the end of the statement? I've been
using $! at the end of my die statements and am afraid that I've been
unknowingly not using the correct syntax
Shawn H Corey wrote:
sftriman wrote:
I use this series of regexp all over the place to clean up lines of
text:
$x=~s/^\s+//g;
$x=~s/\s+$//g;
$x=~s/\s+/ /g;
in that order, and note the final one replace \s+ with a single space.
Basically, it's (1) remove all leading space, (2) remove all
sftriman wrote:
I've been wondering for a long time... is there a slick (and hopefully
fast!) way to do this?
foreach (keys %fixhash) {
$x=~s/\b$_\b/$fixhash{$_}/gi;
}
So if
$x=this could be so cool
and
$fixhash{could}=would;
$fixhash{COOL}=awesome;
$fixhash{beso}=nope;
Steve Bertrand wrote:
Hi everyone,
Hello,
I'm reviewing a script I wrote that I use against one of my modules. The
script takes an optional param at the command line.
Although I am seriously reviewing my options for better and smarter ways
to utilize command line args, I'm curious as to why
Steve Bertrand wrote:
John W. Krahn wrote:
Steve Bertrand wrote:
if ( $month !~ m{ \A \d{4}-\d{2} \z }xms ) {
print \nInvalid date parameter. Must be supplied as '-MM'\n\n;
exit;
You exit the program if $month is not equal to a seven character string.
ehhh.. *scratching head
Parag Kalra wrote:
Hello All,
Hello,
This works on Linux -
perl -e 'foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print I am
only addicted to - 'Shekels' \n if ($_ =~ /^s.*/i) }'
This works on Windoze -
perl -e foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print 'I am
only
Parag Kalra wrote:
On Sat, Dec 12, 2009 at 1:55 AM, John W. Krahn jwkr...@shaw.ca wrote:
Parag Kalra wrote:
This works on Linux -
perl -e 'foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print I
am only addicted to - 'Shekels' \n if ($_ =~ /^s.*/i) }'
This works on Windoze -
perl
Adam Jimerson wrote:
On Dec 7, 12:43 pm, g...@lazymountain.com (Greg Jetter) wrote:
On Sunday 06 December 2009 10:24:31 am Adam Jimerson wrote:
I am working on a registration page and there for want it to show the
user errors it has found with their input. I have two subroutines in
my code,
Shawn H Corey wrote:
Steve Bertrand wrote:
You can replace them all with this:
my $station = $channels{ $opt_s };
my $station = $channels{ $opt_s } || help();
my $station = $channels{ $opt_s } or help();
Or:
( my $station = $channels{ $opt_s } ) || help();
John
--
The programmer is
Noah wrote:
Hi there,
Hello,
I am hoping to figure out the best Way to write something. I have two
arrays @previous_hostnames and @hostnames.
I want to figure out if there is at least one matching element in
@previous_hostnames that is found in @hostnames.
my $found = map { my $x = $_;
Rafa? Pocztarski wrote:
I forgot to cc: the list...
2009/12/10 Noah noah-l...@enabled.com:
I am hoping to figure out the best Way to write something. Â I have two
arrays @previous_hostnames and @hostnames.
I want to figure out if there is at least one matching element in
@previous_hostnames
Jeff Pang wrote:
Noah:
sub exiting {
my ($hostname, %login) = @_;
Passing arguments like this has no such problem.
But you'd better pass the hash as a reference to the subroutine.
exitint($hostname, \%login);
sub exiting {
my $hostname = shift;
my %login = %{+shift};
What is
Xiao Lan (小兰) wrote:
Hello,
Hello,
I have a text whose content is like:
aaaa
bbbbaa
aaxxxbb
bb776yhghhaa
I want to switch all aa and bb.
I can handle this use regex:
s/aa|bb/$ eq 'aa'?'bb':'aa'/ge;
But how to use 'tr' doing that?
$ perl -e'
my @data = qw/
aaaa
Parag Kalra wrote:
Hello All,
Hello,
This code is working:
#!/usr/bin/perl
use warnings;
use strict;
You should include those two pragmas to let perl help you find mistakes
in your code.
2 my @column_names=(A..ZZ);
Why are you creating an array with 702 entries when you are
Parag Kalra wrote:
Hello All,
Hello,
I am looking for a simple way to determine the time taken by any Perl
script.
A simple method would be to put this line somewhere in your program:
END { warn time - $^T, seconds elapsed\n }
A specific module to determine the time of execution will
jackassplus wrote:
I am trying to remove single newlines but not double newlines.
for instance say I have the following:
Name:\nMy Name\n\nAddress:\n123 Anywhere St\n\nAbout Me:\nSome text
that\nhas some newlines that\nI want to be rid of\n\nThe End\n
I want to get rid of all of the newlines
Shawn H Corey wrote:
jackassplus wrote:
I am trying to remove single newlines but not double newlines.
for instance say I have the following:
Name:\nMy Name\n\nAddress:\n123 Anywhere St\n\nAbout Me:\nSome text
that\nhas some newlines that\nI want to be rid of\n\nThe End\n
I want to get rid of
David Schmidt wrote:
2009/11/30 Jay Savage daggerqu...@gmail.com:
Either way, you should be able to use the built-in functions to
accomplish your task. See the docs for sleep(), alarm(), and select()
for more info.
Sorry for the bad explanation of my problem.
Yes my program has to continue
raphael() wrote:
Hi,
Hello,
I want the below if loop to end if it cannot find any match print the die
message.
However it just exit without hitting my die
As you can see in the code below I have tried many foolish ways to make the
script say
that it cannot find the number searched in while
Mark_Galeck wrote:
Why does
$foobar = \(foo, bar);
print $$foobar;
print bar ??
Thank you for any insight. Mark
Because \(foo, bar) is really (\foo, \bar) and the comma
operator in scalar context will return the last item listed so:
$foobar = \(foo, bar);
Is just:
$foobar = \bar;
Jeremiah Foster wrote:
Hi there!
Hello,
This may or may not be a beginners question. If not, please let me
know where I ought to post. :-)
I have a data structure, a simple array. It is made up of sections of
files I have slurped;
sub _build_packages {
use Perl6::Slurp;
Do you
Majian wrote:
Hi, all :
Hello,
I have a problem about the lines of the file ,
like this :
cat test
12
23
34
45
56
67
78
...
==
I want to display like this :
1223
3445
5667
It means the next line is after the last line .
How do it by the Perl ?
$ echo 12
23
34
45
56
Shawn H Corey wrote:
Yonghua Peng wrote:
--- On Tue, 24/11/09, Shawn H Corey shawnhco...@gmail.com wrote:
From: Shawn H Corey shawnhco...@gmail.com
Subject: Re: ç”å¤�: Regex to get last 3 digits of a number.
To: gaochong zjgaoch...@gmail.com
Cc: 'John W. Krahn' jwkr...@shaw.ca, 'Perl
Orchid Fairy (À¼»¨ÏÉ×Ó) wrote:
Hi,
Hello,
# perl -le '$_=aXXXb; print one word is $1 while(/(X*)/g);'
one word is
one word is XXX
one word is
one word is
what are the three empty values in the output?
The pattern X* can match zero characters.
$ perl -le'$_=aXXXb; print one word is
Shawn H Corey wrote:
Also:
$ perl -le '$_=aXXXb; @captured = $_ =~ m{ (X*) }gmsx;print captured:
, join( , ,@captured), '
captured: , XXX, ,
@captured = $_ =~ m{ (X*) }gmsx;
Is usually written as:
@captured = /X*/g;
John
--
The programmer is fighting against the two most
destructive
Shawn H Corey wrote:
Jim Gibson wrote:
On 11/24/09 Tue Nov 24, 2009 4:42 PM, Orchid Fairy (À¼»¨ÏÉ×Ó)
practicalp...@gmail.com scribbled:
On Wed, Nov 25, 2009 at 8:38 AM, Shawn H Corey shawnhco...@gmail.com wrote:
It seems to be picking up an extra empty string after a non-zero length
shadow52 wrote:
Hey everyone,
Hello,
I am trying to get just the last 3 numbers from the following number
from perl using regexs but I have not had no success so I was hoping
that I could get a little help on this. I just ordered the regex book
from oreilly so that hopefully in the future I
Shlomi Fish wrote:
On Thursday 19 Nov 2009 16:54:00 gaochong wrote:
Now I have see the following page ,but I have some question and need help .
http://www.cpan.org/authors/id/S/SU/SUJAI/Process-Detail-0.1.pl
the second , @array=split(/([A-Z]+(_|[A-Z])+\=.[^A-Z]+)/,$_);
also the re
David Christensen wrote:
beginners:
Hello,
Is unlink() supposed to provide an error message on failure?
Yes. All Perl functions that interact with the underlying system will
set $! on failure. ($! is the same as errno in C.)
man 3 errno
man 2 unlink
John
--
The programmer is
Orchid Fairy (À¼»¨ÏÉ×Ó) wrote:
Hello,
Hello,
After making a connected socket to a tcp server, how to implement the
read/write more than once?
for example:
1) make socket connection
2) write a command to socket
3) read the result from remote server
4) write another command to socket
5) read
gaochong wrote:
#!/usr/bin/perl -w
#Auther:gaochong
use strict;
my @list = (3 .. 9);
my @FA=(FA0001..FA2000);
sub mk_fa {
my ($f) = @_;
foreach my $p (@list) {
mkdir /data$p/NRU/$f,0755 or warn mkdir /data$p/NRU/$f
err:$!;
symlink
Jackie Jackie wrote:
I tried to adapt this code to obtain my desired output. I need help. My logic is
While
if lines are not empty {do}
if lines are empty {do}
While
if lines are not empty {do}
else for empty lines{do}
I am new to programming. I have problem with logic and syntax. So please
Dermot wrote:
2009/11/13 Subhashini subhashinibasavar...@gmail.com:
I am doing a coversion on french to english words.I have installed the
dictionary and i could use it on my command prompt using the following
command.
dict -d fd-fra-eng bonjour This is a french to english coversion
dict
Anant Gupta wrote:
..
use strict;
..
my %hash;
my $abc;
my $count;
while(defined($ARGV[$count]))
{
push(@hash{$abc},$ARGV[$count]);
}
Can't i use this
The error is Type of arg 1 must be array not hash element ...
@hash{$abc} is a hash slice. You probably want @{$hash{$abc}}.
John
Anant Gupta wrote:
..
use strict;
..
my %hash;
my $abc;
my $count;
while(defined($ARGV[$count]))
{
push(@hash{$abc},$ARGV[$count]);
}
@ARGV gets its values from the command line so all its elements should
be defined, unless you are using delete() on one of its elements. You
are not
rithu wrote:
Hi,
Hello,
I'm an oracle user. One of my implementation needs a little bit of
perl usage.
i've an array(@hexa_tableau) which contains restricted hexadecimal
characters and a string which is converted into hexadecimal.
while ((@carac) = $sel-fetchrow_array) {
rithu wrote:
Hi,
Hello,
Please help me to split a string as follows..
my $line = abcdefghijkl
the expected output should be like:
ab
ef
ij
The logic is like alternate 2 characters should be removed
$ perl -le'
my $line = abcdefghijkl;
my @data = unpack (a2x2)*, $line;
print for
Nathan Gibbs wrote:
How would I get the length of a string as returned by length () into
a 4 byte unsigned integer in network byte order
my $length = pack 'N', length $string;
John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human
tom smith wrote:
On Fri, Nov 6, 2009 at 12:15 AM, John W. Krahn jwkr...@shaw.ca wrote:
Michael Alipio wrote:
if I have a script that accepts any combination of the 5 or maybe even
more options, say, option1, option2, option3...
Now, after collecting the options, for each option
À¼»¨ÏÉ×Ó wrote:
Hello,
Hello,
doesn't one-liner Perl command support __DATA__ handler?
No. It only works in an actual file located on a real file system.
Just found this:
# perl -e 'while(DATA){ print }
__DATA__
abc
123
def
'
run without any output.
You could always do it like
Michael Alipio wrote:
Hi,
Hello,
if I have a script that accepts any combination of the 5 or maybe even
more options, say, option1, option2, option3...
Now, after collecting the options, for each option, there is a
corresponding regexp pattern. I will then build an if statement, where
the
Parag Kalra wrote:
Hey Folks,
Hello,
I Frequently use perl to process 2 files line by line.
Most of the times I compare two files line by line and check if one line is
same to corresponding line of other file, or if one line is substring of
other line etc and many more operations.
The
Majian wrote:
Hi ,all :
Hello,
I want to know if there is a way in which I can randomnize(?) the content in
an array.
In this example :
my @array = ('uriel', 'daniel', 'joel', 'samuel');
Now what I want is create a process so every time I print the array it
prints one element from the
Philip Potter wrote:
2009/11/3 John W. Krahn jwkr...@shaw.ca:
Majian wrote:
my @array = ('uriel', 'daniel', 'joel', 'samuel');
Now what I want is create a process so every time I print the array it
prints one element from the array .
I wrote it like this :
#!/usr/bin/perl -w
use strict
Majian wrote:
Thanks all .
Hello,
But I found an another question :
If I wrote this script like this :
#!/usr/bin/perl
use warnings;
use strict;
while (DATA){
@lines = $_;
You are assigning one scalar value to the whole array the array will
only ever have one element in it.
You
tom smith wrote:
On Mon, Nov 2, 2009 at 7:41 PM, Remy Guo rollingst...@gmail.com wrote:
i've got problem when trying to perform a substitution.
the text file i want to process is like this:
...
XX {
ABDADADGA
afj*DHFHH
} (a123)
XXDFAAF {
af2hwefh
fauufui
} (b332)
...
i want to match
Majian wrote:
Hi ,all:
Hello,
When I test the increment operator in Perl and find a question :
The question is :
#!/usr/bin/perl
use warnings;
my $i = 1;
print ++$i + ++$i, \n;
The above code prints out the answer 6 .
But in the other language the anser is 5 ,
And the lesson to
tom smith wrote:
On Tue, Nov 3, 2009 at 4:33 PM, tom smith climbingpartn...@gmail.comwrote:
Thanks for the tips! More comments below.
I saw it written the other way somewhere, and I thought it looked cleaner.
I'll do it your way from now on.
if ($line =~ /\((.*?)\)/) {
$line
Brent Clark wrote:
Hiya
Hello,
I was hoping that someone would be kind to help me.
I have a string like so :
Haresources : 10.203.4.5, Interfaces : 10.203.4.5 10.203.4.7
Im trying to get the ip's after Interfaces into an array, but for the
likes of me, im just not getting it right. This
John W. Krahn wrote:
Brent Clark wrote:
I was hoping that someone would be kind to help me.
I have a string like so :
Haresources : 10.203.4.5, Interfaces : 10.203.4.5 10.203.4.7
Im trying to get the ip's after Interfaces into an array, but for the
likes of me, im just not getting it right
Anant Gupta wrote:
Hello,
Hello,
In the foreach loop, without going to the beginning of the loop, i want to
get the next iteration of data. How do i get it.
eg
use strict;
open(FILE,abc.txt) or die CAnnot open;
my @lines=FILE;
foreach my $line(@lines)
{
if($lin =~ m/something/)
{
Philip Potter wrote:
2009/11/2 Thomas Bätzler t.baetz...@bringe.com:
while( my $line = $file ){
snip
}
Won't this loop terminate early if there is a blank line or a line
containing only '0'? If I do a readline loop I always do:
while (defined ($line = $file))
Is there something magical
Remy Guo wrote:
hi folks,
Hello,
i've got problem when trying to perform a substitution.
the text file i want to process is like this:
...
XX {
ABDADADGA
afj*DHFHH
} (a123)
XXDFAAF {
af2hwefh
fauufui
} (b332)
...
i want to match the content in the parenthesis (a123 and b332, here)
Parag Kalra wrote:
Hello Folks,
Hello,
This is my first post here.
I am trying to emulate Linux 'sort' command through Perl. I got following
code through Internet to sort the text file:
# cat sort.pl
my $column_number = 2; # Sorting by 3rd column since 0-origin based
my $prev = ;
for (
Shawn H Corey wrote:
Parag Kalra wrote:
# cat sort.pl
my $column_number = 2; # Sorting by 3rd column since 0-origin based
my $prev = ;
for (
map { $_-[0] }
sort { $a-[1] cmp $b-[1] }
map { [$_, (split)[$column_number]] }
map { [$_, (split)[$column_number]] . $_ }
) {
print
Steve Bertrand wrote:
Hi all,
Hello,
Within a CGI environment, I'm trying to do a dispatch table test, but
can't figure out how to call the coderef as a method. Here is the
working code. I'll describe what doesn't work afterwards:
sub perform_find {
my $self= shift;
my
Jyoti wrote:
Hello All,
Hello,
I just want help to open and read a file. I have to make a script so that it
should open and read a file which is in fasta format. I have done something
with subroutine but getting some errors. May be everyone do not know the
fasta format
Fasta format have
Michael Alipio wrote:
Hi,
Hello,
How do I split a word into n subsets?
my $word = thequickbrown
If I want three subsets I should be able to create:
the
heq
equ
upto
own
$ perl -le'
my $word = thequickbrown;
my $subsets = 3;
print for $word =~ /(?=(.{$subsets}))/g;
'
the
heq
Shawn H Corey wrote:
John W. Krahn wrote:
$ perl -le'
my $word = thequickbrown;
my $subsets = 3;
print for $word =~ /(?=(.{$subsets}))/g;
Getting up there but substr is still the fastest.
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
# Make Data::Dumper pretty
$Data
Majian wrote:
Hi,all:
I have the text like this:
xxx sum = 1,
xx
xx
xx
d_bits
xxx
xxx
xx sum =0
xx
xx
xx
d_bit
xx
My question is : How can I read the nextline after the d_bits if sum = 1?
$ echo
xxx sum = 1,
xx
xx
xx
d_bits
x1xx
x2xx
xx sum =0
xx
xx
xx
d_bit
xx
| perl
sanket vaidya wrote:
Hi,
Hello,
Consider the code below:
use warnings;
use strict;
my $string = '100955 BLow-Gomez,Joseph MMEX.AMER. QHUTC012';
my ($id) = split(/\s/,$string);
print id = $id;
Output:
100955
Now remove brackets surrounding $id like as under:
use warnings;
use strict;
Anant Gupta wrote:
I wrote
#!usr/bin/perl
use Socket;
use constant ADDR = 'www.google.com';
my $name=shift || ADDR;
$packed=gethostbyname($name);
$dotted-inet_ntoa($packed);
print DOtted Address is $packed;
but it is showing an error
Bad argument length for Socket length in inet_ntoa ???
hongyi.z...@gmail.com wrote:
On Thursday, October 22, 2009 at 15:08, mrdanwal...@gmail.com wrote:
2009/10/19 Hongyi Zhao hongyi.z...@gmail.com:
I want to write a script to note specific IP
 addresses by appending the corresponding location informations.  For
I suggest you take a look at
Majian wrote:
Dear list:
Hello,
Sorry to distrub all .
When I learned Perl on the book called Perl by example 4th
Chinese Edition , I found there was an error on this book .
There had a perl script writted by this :
#!/usr/bin/perl
Majian wrote:
Dear list:
Hello,
I have a question on learning Perl . Please give me a help .
The problem is :
How can I split a string into chunks of size n bytes?Like this :
#!/usr/bin/perl
my $string = 1234567890abcdefghijABCDEFGHIJK;
my $n = 2;# $n is group size.
my @groups =
Harry Putnam wrote:
John W. Krahn jwkr...@shaw.ca writes:
Harry Putnam wrote:
I'm not sure what these errors are telling me.
The script is supposed to remove dups from .bash_history
Wouldn't it be simpler to set HISTCONTROL to ignoredups:
export HISTCONTROL=ignoredups
Or:
export
Harry Putnam wrote:
I'm not sure what these errors are telling me.
The script is supposed to remove dups from .bash_history
Wouldn't it be simpler to set HISTCONTROL to ignoredups:
export HISTCONTROL=ignoredups
Or:
export HISTCONTROL=ignoreboth
but not operate on the last 12 lines...
Raheel Hassan wrote:
Thanks Arun and Rob,
For example if this is the url then ,
https://localhost/Iv2/cbox/cbox-gui.pl?action=status
my ($myself) = split(/\?/,$q-self_url);
#$myself = https://localhost/Iv2/cbox-gui.pl
my @base_url = split(/\//, $myself);
# @base_url = {localhost, Iv2,
Soham Das wrote:
The Code:
use strict;
use warnings;
use Tie::Handle::CSV;
my $qbook = Tie::Handle::CSV-new('C:\Documents and Settings\Soham
Das\Desktop\Quotes.csv',header=1);
my $tradebook = Tie::Handle::CSV-new('C:\Documents and Settings\Soham
Das\Desktop\Transactions.csv',header=1);
my
Raheel Hassan wrote:
Hello,
Hello,
I have problems in understanding $...@$ use ?
1- my $ref = $$temp_sth - fetchall_arrayref({});
for(my $i=0; $i = $...@$ref}; $i++) {
push(@$temp_table,$ref-[$i]);}
$...@$ref} should be $#{$ref} or simply $#$ref
And
for(my $i=0; $i =
Jesus Fernandez wrote:
Dear friends,
Hello
I'm trying to write a program that draws 5,000 numbers from an exponential
distribution with mean 4N/k(k-1)
N=10 000
k = 25
I have this:
#!jesusafernandez/bin/perl
use warnings;
use strict;
$k = 25;
my $k = 25;
$N = 1;
my $N =
Slick wrote:
Just clarification. At this time I have not written any of my code
(dont' know where to begin yet, however the website that I am looking
at perl.begin.org seems to have diffrent methods for one item. I have
seen @ for arrays written like this: @myarray ,but I have also seen
an
Mike Flannigan wrote:
I want to change character code 160 to character
code 32 throughout a bunch of text files. I'm using
this right now
s/(.)/ord($1) == '160' ? chr(32) : $1 /eg;
Here you are using the decimal numbers 160 and 32. This is very
inefficient as you are searching for *every*
Bryan R Harris wrote:
I need to convert a number like this: -3205.0569059
... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a bc 93
d3 (I just made up those 8 byte values).
Is this easy in perl? Are long and short ints easy as well?
$ perl -le'print unpack H*, pack d,
Bryan R Harris wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
I need to convert a number like this: -3205.0569059
... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a bc 93
d3 (I just made up those 8 byte values).
Is this easy in perl? Are long and short ints easy
Noah Garrett Wallach wrote:
Hi there Perl folks,
Hello,
Okay I am trying to figure this out.
I am trying to match the following:
$line = blahblahblah
so I have the following line to match that
$line =~ /((?:blah).*?){0,5}/;
But I want to capture blah in a variable like
$capture = $1;
Steve Bertrand wrote:
[ forgive me if it was sent twice. My first should be bounced as bad
sender addr ].
Besides consistently forgetting how to properly spell ternary, I
can't, for some reason, embed it's use into my brain no matter how much
I read.
It is borrowed from the C programming
Philip Potter wrote:
2009/9/11 Uri Guttman u...@stemsystems.com:
SB == Steve Bertrand st...@ibctech.ca writes:
SB Besides consistently forgetting how to properly spell ternary, I
SB can't, for some reason, embed it's use into my brain no matter how
SB much I read.
ternary op is an official
John Plum wrote:
HI Folk,
Hello,
May I introduce myself, John Plumridge, London, UK.
John W. Krahn, Vancouver, Canada.
- I'm still in awe of this whole creation we're in.
Life?
Nice to meet you.
And very nice to meet you as well.
I have a reason of course
Philip Potter wrote:
2009/9/11 John W. Krahn jwkr...@shaw.ca:
Philip Potter wrote:
Does ?: guarantee that only one arm of its conditions will be executed?
eg:
# @_ has 3 elements
$x = $flag ? shift : push;
$ perl -e'$x = $flag ? shift : push;'
Not enough arguments for push at -e line 1
John W. Krahn wrote:
$ cat ternary-test.c
#include stdio.h
#include stdlib.h
char *shift ( int *argc, char **argv ) {
int i;
char *temp = argv[ 0 ];
for ( i = 1; i *argc; ++i ) {
argv[ i - 1 ] = argv[ i ];
}
Opps, also need to adjust argc here:
--*argc
Philip Potter wrote:
2009/9/11 Steve Bertrand st...@ibctech.ca:
Uri Guttman wrote:
it is actually very simple to understand. the key point to knowing it
and how to use it is that the 2 value expressions SHOULD NOT have side
effects. that means changing something by assignment or other
Philip Potter wrote:
My point is that C documents its behaviour. It seems that Perl
doesn't.
man perl
perldoc perl
http://oreilly.com/catalog/9780596000271/
http://perldoc.perl.org/
perldoc -q Is there an ISO or ANSI certified version of Perl
C's documentation is complete,
C is a very
John W. Krahn wrote:
Philip Potter wrote:
2009/9/11 Steve Bertrand st...@ibctech.ca:
Uri Guttman wrote:
it is actually very simple to understand. the key point to knowing it
and how to use it is that the 2 value expressions SHOULD NOT have side
effects. that means changing something
Philip Potter wrote:
2009/9/11 John W. Krahn jwkr...@shaw.ca:
Philip Potter wrote:
My point is that C documents its behaviour. It seems that Perl
doesn't.
man perl
perldoc perl
http://oreilly.com/catalog/9780596000271/
http://perldoc.perl.org/
perldoc -q Is there an ISO or ANSI certified
Chas. Owens wrote:
On Fri, Sep 11, 2009 at 09:56, John W. Krahn jwkr...@shaw.ca wrote:
snip
You can't tell everything about the language from the docs.
Give me an example, I'll point you to the docs. (Have you read them all?)
snip
Okay, I will bite, where is it documented that
(@a) x= 3
Jyoti wrote:
Can someone explain me what these symbols mean in regular expression:
my $trim = sub {local($_)=shift;
$$_ =~ s/^\s*//;
^ means that you want to anchor the pattern at the beginning of the
string in $$_. \s is a character class that matches the whitespace
characters , \t,
Noah Garrett Wallach wrote:
Okay I am having troubles finding this. in the perldoc modules.
Is there a slicker way to write the following?
if ($line =~ /(Blah1)(.*)/) {
At this point we know that the pattern matched so $1 will contain the
string Blah1 and $2 will contain a string of
Chuck Crisler wrote:
How do I access specific character positions in a scalar string? In case
it makes any difference, I specifically want to test the zeroth
character. Something like the following.
my $str = abc;
if ($str[0] == '#')
{
do something...
}
if ( substr( $str, 0, 1 ) eq
Tim Bowden wrote:
I'm trying to extend (again) the short regex checking script given in
Learning Perl (Absolutely fabulous book btw! Highly recommend it to
anyone trying to learn Perl). I'd like to cycle through the memory
variables printing those as well as $`, $ and $' as given in the
Peter Xu wrote:
Hi, everyone,
Hello,
I've met some problem while practice my perl. It seems that in some
condition,
sysread() doesn't work?
codes here:
#!/usr/bin/perl -w
use strict;
$| = 1;
open my $file, , test.txt or die;
## if these add
Peter Xu wrote:
John W. Krahn wrote:
perldoc -f sysread
sysread FILEHANDLE,SCALAR,LENGTH,OFFSET
sysread FILEHANDLE,SCALAR,LENGTH
Attempts to read LENGTH bytes of data into variable SCALAR
from the specified FILEHANDLE, using the system call
read(2
Steve Bertrand wrote:
Hi all,
Before chasing down and fixing an undef var earlier on in a trace path,
I had the following code. I've finally gathered that fixing bugs and
validating data upstream is far better than writing code to fix it later
(of course, I had to write code to find out what
jet speed wrote:
Hi,
Hello,
I would like to join the $abc with ':' the final desired output 1:2:3:4:5
#!/usr/bin/perl
use strict;
use warnings;
my $abc = 1 2 3 4 5;
my $out = join ':', $abc;
print $out;
executing the above, i get the same output 1 2 3 4 5, not sure were am going
wrong.
Admin wrote:
Hi there,
Hello,
is there a page that explains the ||= operator and similar operators?
google is not quite finding the special characters in the first 10 hits.
$left ||= $right
is just short for:
$left = $left || $right
and || is the logical OR operator. So if $left is
jet speed wrote:
Hi,
Hello,
I have a query on converting arrays into hash.Please could you help me
resolve the below.
I have 2 arrays as bleow.
@array1 = ( D_101 D_102 D_103 D_104);
@array2 = (0 1 2 3);
How can i convert both of these arrays into %hash, assigining the
@array1 as keys
Bryan R Harris wrote:
According to the FAQ you want to do it like this:
s/^\s+//, s/\s+$// for $var;
I can't find documentation of this notation anywhere, i.e. the comma between
statements with a trailing for.
John, where do you find all this cool stuff?
This is just something you pick
Bryan R Harris wrote:
A question about the comma operator:
(John and Chas deserve a rest from my questions, if they want it =).
The binary comma operator in scalar context supposedly evaluates its left
argument, throws that value away, then evaluates its right argument and
returns that
sys adm wrote:
1. why perl doesn't have a built-in strip() function?
Why doesn't BASIC have built-in regular expressions? Why doesn't C have
built-in strings? Why doesn't $LANGUAGE have built-in $FEATURE?
Because that is the way the language was designed.
each time I need
to say $var
Ed Avis wrote:
sys adm sysadm at computermail.net writes:
1. why perl doesn't have a built-in strip() function?
each time I need to say $var =~ s/^\s+|\s+//g to strip
Good question. Perl 6 is fixing this by adding a 'trim' operator.
The code I use is
for ($var) { s/\A\s+//; s/\s+\z/ }
501 - 600 of 4914 matches
Mail list logo