> "BRH" == Bryan R Harris writes:
>>> "BRH" == Bryan R Harris writes:
>> how would that work any better as $_ is still set to each element?
BRH> Because somehow the $_ is localized with foreach where it is not with the
BRH> implicit (?) while loop.
foreach always localizes its
>> "BRH" == Bryan R Harris writes:
>
> BRH> Much to my chagrin I realized this morning that this notation:
>
> BRH> while() {
>
> BRH> evaluates as:
>
> BRH> while(defined($_ = )) {
>
> BRH> ... and NOT as:
>
> BRH> while(defined(local $_ = )) {
>
> BRH> I ha
On Tue, Mar 9, 2010 at 12:41 PM, Bryan R Harris
wrote:
>
>
> Much to my chagrin I realized this morning that this notation:
>
> while() {
>
> evaluates as:
>
> while(defined($_ = )) {
>
> ... and NOT as:
>
> while(defined(local $_ = )) {
>
so how about while (my $line = ) instead of usin
> "BRH" == Bryan R Harris writes:
BRH> Much to my chagrin I realized this morning that this notation:
BRH> while() {
BRH> evaluates as:
BRH> while(defined($_ = )) {
BRH> ... and NOT as:
BRH> while(defined(local $_ = )) {
BRH> I had a subroutine that was set up
Much to my chagrin I realized this morning that this notation:
while() {
evaluates as:
while(defined($_ = )) {
... and NOT as:
while(defined(local $_ = )) {
I had a subroutine that was set up to read and parse a file, but it was
trashing the value of $_ out in the main program!
"John W. Krahn" writes:
>> Like: next if(! $File::Find::dir =~ /$dir_rgx/);
>
> No. Because you are inside a subroutine you have to use return:
>
> return unless $File::Find::dir =~ /$dir_rgx/;
>
> Or perhaps:
>
> return if $File::Find::dir !~ /$dir_rgx/;
>
Thanks.
>> or
>> Like I've don
Jay:
Jay Savage wrote on 03/08/2010 08:53:40 PM:
> It sounds like Term::Readline is using Term::ReadLine::Gnu as the
> back-end. The problem there is that, to Perl, the XS call for GNU
> readline() looks like a single system call.
> Try setting the PERL_RL environment to "Perl" instead of "Gnu":
On Mon, Mar 8, 2010 at 10:27 AM, Eric Veith1 wrote:
> "Bob McConnell" wrote on 03/05/2010 08:22:23 PM:
>> The way I read his problem description, it sounded neither simple nor
>> easy.
>
> Bob, Jay,
>
[snip]
> You see, there's IPC on the local machine and possibly sockets to a remote
> machine.
> "TE" == Tony Esposito writes:
TE> You miss my point but thanks for the syntax check. I am concerned
TE> with comparing the functionality, one versus the other.
they are not comparable at all. tr/// works on individual characters and
nothing else. s/// works with regexes which can modi
Tony Esposito wrote:
On Mon, 8/3/10, John W. Krahn wrote:
Tony Esposito wrote:
Does tr/'\n'/' '/
Replace every ' with ' and every "\n" with " " and every ' with '.
Should probably just be tr/\n/ /.
do the same as tr/'\n'/' '/g?
I assume you mean s/'\n'/' '/g because /g is not a valid o
Sorry about the syntax errors ... Yes, just want to replace all newline
characters with a space and since tr does not have g (global) 'option' I was
thinking that s/\n/ /g is actually better. Or does tr do a global translate by
default?
Thanks
--- On Mon, 8/3/10, John W. Krahn wrote:
From:
You miss my point but thanks for the syntax check. I am concerned with
comparing the functionality, one versus the other.
Thanks.
--- On Mon, 8/3/10, Shawn H Corey wrote:
From: Shawn H Corey
Subject: Re: tr// versus s///g
To: "Tony Esposito"
Cc: "Beginners Perl"
Date: Monday, 8 March, 20
Harry Putnam wrote:
I want to know if doing something like what is in the code below would
be expensive or for some other reason a bad choice.
There is more code, that either feeds the `find()' function or further
processes the results of the `find()' part. The code is not in
finished form, or
Tony Esposito wrote:
Does tr/'\n'/' '/
Replace every ' with ' and every "\n" with " " and every ' with '.
Should probably just be tr/\n/ /.
do the same as tr/'\n'/' '/g?
I assume you mean s/'\n'/' '/g because /g is not a valid option for
tr///. That will replace the string "'\n'" with
Tony Esposito wrote:
> Does tr/'\n'/' '/ do the same as tr/'\n'/' '/g? ( replace newline with space
> )
> If so, is one preferred over the other?
Neither of the above is correct. The correct forms are:
tr/\n/ /;
s/\n/ /g;
--
Just my 0.0002 million dollars worth,
Shawn
Programming is
YAPH wrote on 03/05/2010 06:57:19 PM:
> It was the shell construc, eval '' if 0; (Will this ever
> execute?)
>
> and the
>
> exec /bin/perl $0 ${1+"$@"};
>
> that threw me off.
YAPH:
Actually, the first constructs gets read and interpreted by both shell and
perl. However, Perl doesn't e
"Bob McConnell" wrote on 03/05/2010 08:22:23 PM:
> The way I read his problem description, it sounded neither simple nor
> easy.
Bob, Jay,
I fear, Jay, my explanaitions weren't fully able to depict what my app is
trying to archieve. It is not only a matter of IPC on one machine that
happens to
Does tr/'\n'/' '/ do the same as tr/'\n'/' '/g? ( replace newline with space )
If so, is one preferred over the other?
Harry Putnam wrote:
> find(
> sub {
> ## if we have a directory name that matches
> if($File::Find::dir =~ /$dir_rgx/){
> ## if that directory has files with all numeric names
> if(/^\d+$/){
if( ! /\D/ ){
> ## Open the files and search for a regex in
Harry Putnam writes:
> [...]
>
> find(
> sub {
> ## if we have a directory name that matches
> if($File::Find::dir =~ /$dir_rgx/){
> ## if that directory has files with all numeric names
> if(/^\d+$/){
> ## Open the files and search for a regex in
Randal L. Schwartz wrote:
"ANJAN" == ANJAN PURKAYASTHA writes:
ANJAN> OK, suppose I develop a Perl application. I want to create an icon for
the
ANJAN> program so that a user may download the program and start it in the GUI
by
ANJAN> double-clicking on the icon.
Did I miss something? Wher
I want to know if doing something like what is in the code below would
be expensive or for some other reason a bad choice.
There is more code, that either feeds the `find()' function or further
processes the results of the `find()' part. The code is not in
finished form, or tested, but more to s
22 matches
Mail list logo