Re: Confused with File::Find

2017-06-25 Thread Harry Putnam
and...@geekuni.com (Andrew Solomon) writes: [...] > The way it works it that `find` is traversing through the directories and > `$File::Find::dir` is the directory it's *in* when it calls your subroutine > on `$File::Find::name` which is inside that directory. When it was sitting > in `/three` it

Re: Confused with File::Find

2017-06-24 Thread Andrew Solomon
Here's a small tweak to your initial script which goes some way toward shedding light on what was going wrong: #!/usr/bin/env perl use strict; use warnings; use File::Find; use feature 'say'; my $d = './one'; find sub { return if -f; say $File::Find::name; say "\$File::Find::dir<$Fi

Re: Confused with File::Find

2017-06-24 Thread Harry Putnam
shlo...@shlomifish.org (Shlomi Fish) writes: > $File::Find::dir is the containing directory of the path item (= the > dirname in http://perldoc.perl.org/File/Basename.html ). Finally, > note that File::Find has OK, I guess I follow that. As you see in my reply to Andrew S, I kind of fumbled my w

Re: Confused with File::Find

2017-06-24 Thread Harry Putnam
and...@geekuni.com (Andrew Solomon) writes: > Hi Harry > > What do you want your code to do? > Devise a simple test script the counts the number of directories in a hierarchy (This is building toward a more complex script in the end). But taking small steps in an effort to really understand what

Re: Confused with File::Find

2017-06-24 Thread Shlomi Fish
Hi Harry! On Fri, 23 Jun 2017 16:56:13 -0400 Harry Putnam wrote: > Trying for a better understand of using File::Find, butI'm missing > something pretty basic I think > > First: The directory structure in this test: > > ./one/tst.pl > two/tst.pl > three/tst.pl > > So each directory

Re: Confused with File::Find

2017-06-24 Thread Andrew Solomon
Hi Harry What do you want your code to do? Andrew On Fri, Jun 23, 2017 at 9:56 PM, Harry Putnam wrote: > Trying for a better understand of using File::Find, butI'm missing > something pretty basic I think > > First: The directory structure in this test: > > ./one/tst.pl > two/tst.pl >

Re: confused about reference

2008-10-30 Thread Richard Lee
Richard Lee wrote: I was just testing some reference and while trying out below I am trying to understand below @{$yahoo->{yahoo}}... I can see that this is pointing to 0,1,3 by running the code. But I am trying to really understand whether this is trying to say since value of 'yah

Re: confused about a regex

2007-03-08 Thread oryann9
Yes I understand now. For some reason I missed the missing quotes in the original post and the word token came to mind. $ perl -MO=Deparse foo.plx BEGIN { $^W = 1; } use diagnostics; sub abc { use warnings; use strict 'refs'; 'abc.'; } sub e { use warnings; use strict 'ref

Re: confused about a regex

2007-03-08 Thread Chas Owens
On 3/8/07, oryann9 <[EMAIL PROTECTED]> wrote: snip Why is $_=abc.e.i short for $_ = 'abc' . 'e' . 'i'; snip from "Programming Perl 3rd Edition": bareword A word sufficient ambigious to be deemed illegal under use strict 'subs'. In the absence of that stricture, a barew

Re: confused about a regex

2007-03-08 Thread oryann9
> $_=abc.e.i; > > This is short for: > > $_ = 'abc' . 'e' . 'i'; > > Which is the same as saying: > > $_ = 'abcei'; > Why is $_=abc.e.i short for $_ = 'abc' . 'e' . 'i'; Is it b/c each group of characters is a 'token' including the periods? abc => token . =>

Re: confused about a regex

2007-03-08 Thread Jeni Zundel
I have to say - I am totally enamored with regex. Color me 'goober'. I just think that is a beautiful, concise, elegant way to make a substitution. All of that capability in one short string of characters... No if, then, else construct. Just - capture what is there; if it matches a .\w

Re: confused about a regex

2007-03-07 Thread Chas Owens
On 3/7/07, Jennifer Foo <[EMAIL PROTECTED]> wrote: $_=abc.e.i; This is short for: $_ = 'abc' . 'e' . 'i'; Which is the same as saying: $_ = 'abcei'; Thanks.I never knew that it can write a string like this way. You probably shouldn't though. It is a carry over from the earli

Re: confused about a regex

2007-03-07 Thread Jennifer Foo
$_=abc.e.i; This is short for: $_ = 'abc' . 'e' . 'i'; Which is the same as saying: $_ = 'abcei'; Thanks.I never knew that it can write a string like this way. _ FREE Email @ Fadmail.com - http://www.fadmail.com --

Re: confused about a regex

2007-03-07 Thread John W. Krahn
Jennifer Foo wrote: > Someone posted this regex question which I can't understand for. > > perl -e '$_=abc.e.i; > s/(\.\w+)?$/.out/; > print;' > > the result is: abcei.out > > Why is this?Please help explain it.Thanks! $_=abc.e.i; This is short for: $_ = 'abc' . 'e' . 'i';

Re: confused about a regex

2007-03-07 Thread Chas Owens
On 3/7/07, Jennifer Foo <[EMAIL PROTECTED]> wrote: Someone posted this regex question which I can't understand for. perl -e '$_=abc.e.i; s/(\.\w+)?$/.out/; print;' the result is: abcei.out Why is this?Please help explain it.Thanks! I think you will be less confused if you change the

Re: Confused about supplying command line arguments and using @ARGV

2004-06-04 Thread Jenda Krynicky
From: "Dennis G. Wicks" <[EMAIL PROTECTED]> > I just did extensive testing using ActiveState perl on XP-Pro > and I get the exact same results. > > C:\DATAFI~1>argv.pl testfile > > gives the unitialized variable message but > > C:\DATAFI~1>perl argv.pl testfile > > works as expected. It ain'

Re: Confused about supplying command line arguments and using @ARGV

2004-06-04 Thread David Kirol
08:29:45 -0400 (EDT) > > From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> > > Reply-To: [EMAIL PROTECTED] > > To: Larry Wissink <[EMAIL PROTECTED]> > > Cc: [EMAIL PROTECTED] > > Subject: Re: Confused about supplying command line argum

RE: Confused about supplying command line arguments and using @ARGV

2004-06-04 Thread Larry Wissink
y' Pinyan [mailto:[EMAIL PROTECTED] Sent: Thursday, June 03, 2004 5:30 AM To: Larry Wissink Cc: [EMAIL PROTECTED] Subject: Re: Confused about supplying command line arguments and using @ARGV On Jun 2, Larry Wissink said: >I want to supply the name of a file on the command line when executing

Re: Confused about supplying command line arguments and using @ARGV

2004-06-03 Thread Dennis G. Wicks
400 (EDT) > From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > To: Larry Wissink <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Subject: Re: Confused about supplying command line arguments and using > @ARGV > > On Jun 2, Larry

Re: Confused about supplying command line arguments and using @ARGV

2004-06-03 Thread Jeff 'japhy' Pinyan
On Jun 2, Larry Wissink said: >I want to supply the name of a file on the command line when executing a >script. Unfortunately, I'm getting an error that says that @ARGV is >uninitialized. > >How do you initialize @ARGV? How do you specify command line arguments? You don't initialize @ARGV. It

Re: confused - if function

2004-04-28 Thread Jeff Westman
You are absolutely correct, that the my is included inside the { } block. But that is exactly where the confusion sets in, having had this problem when I started coding in perl. The { } are required when using an if/else construct -- part of the syntax to perform this function. Whereas a bloc

Re: confused - if function

2004-04-27 Thread William.Ampeh
It works, but it prints nothing. You are basically dealing with 3 variable here. the first 2 $date1 goes out of scope outside if {} else {}. Simply move your declaration out of the if statement. That is: my $date1 = ""; if ( your condition){ $date1=localtime; } else { . . }; pr

Re: confused - if function

2004-04-27 Thread James Edward Gray II
On Apr 27, 2004, at 5:39 AM, mike wrote: I am getting a bit confused here, if I uncomment out the print statement within the if block $date1 prints, however the $date1 after the if block doesn't if ($date eq ''){ my $date1=localtime; #print $date1; } else { my $date1=~$date; }; print $date1; an

Re: Confused

2004-03-25 Thread WC -Sx- Jones
mike wrote: This worked s/\s+$/; One question will this only take out blank lines? eg: if I have this line anytext tabe space newline will the non-printing characters be removed and the text be added to the beginning of the next line? This will only remove whitespace from the END of a line. If

Re: Confused

2004-03-25 Thread mike
On Wed, 2004-03-24 at 14:19, James Edward Gray II wrote: > On Mar 24, 2004, at 7:59 AM, WC -Sx- Jones wrote: > > > while() { > > chomp; s/^\s+//; s/\s+$//; next unless length; > > There's probably not much reason to chomp() and s/\s+$//, since the > later handles both. > > James > Thanks

Re: Confused

2004-03-24 Thread WC -Sx- Jones
James Edward Gray II wrote: On Mar 24, 2004, at 7:59 AM, WC -Sx- Jones wrote: while() { chomp; s/^\s+//; s/\s+$//; next unless length; There's probably not much reason to chomp() and s/\s+$//, since the later handles both. Yes, and I forget that the way I used it chomp only gets ONE \n --

Re: Confused

2004-03-24 Thread James Edward Gray II
On Mar 24, 2004, at 7:59 AM, WC -Sx- Jones wrote: while() { chomp; s/^\s+//; s/\s+$//; next unless length; There's probably not much reason to chomp() and s/\s+$//, since the later handles both. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

Re: Confused

2004-03-24 Thread John W . Krahn
On Wednesday 24 March 2004 06:07, John W. Krahn wrote: > On Tuesday 23 March 2004 13:13, mike wrote: > > I am trying to get rid of a blank line at the start of a text file, > > and I dont understand why this does not work > > > > open(UPD1,"tem");# this file exists > > You should *ALWAYS* verify th

Re: Confused

2004-03-24 Thread John W . Krahn
On Tuesday 23 March 2004 13:13, mike wrote: > > I am trying to get rid of a blank line at the start of a text file, > and I dont understand why this does not work > > open(UPD1,"tem");# this file exists You should *ALWAYS* verify that the file opened successfully. open UPD1, 'tem' or die "Cannot

Re: Confused

2004-03-24 Thread WC -Sx- Jones
mike wrote: I am trying to get rid of a blank line at the start of a text file, and I dont understand why this does not work open(UPD1,"tem");# this file exists my @update1=; foreach $update1(@update1){ $update1=~s/^(\n)//; while() { chomp; s/^\s+//; s/\s+$//; next unless length; $update1

Re: Confused on hash references

2003-02-13 Thread Lance
Check out Data::Dumper, you'll love it! www.perldoc.com Pass it a ref and it prints out a pretty data structure recursively, so you don't have to! Ain't Perl Grand? "Barry Kingsbury" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have created the following

Re: Confused on hash references

2003-02-13 Thread Jeff 'japhy' Pinyan
On Feb 13, Barry Kingsbury said: >I have created the following data structure: > >%mailings = ( tv => { mail_demo_key => "Demo License Key for TotalView", > mail_thank_you => "Thank you for downloading >TotalView", > pdf => LOCATION_OF_PDF,

RE: Confused on hash references

2003-02-13 Thread wiggins
On Thu, 13 Feb 2003 09:21:13 -0500, Barry Kingsbury <[EMAIL PROTECTED]> wrote: > Can some guru explain? > They have already ;-)...have you done your reading? perldoc perlreftut perldoc perlref These are two excellent starting places, and shoul

Re: confused with File::Glob

2003-02-09 Thread Rob Dixon
Harry Putnam wrote: > "John W. Krahn" <[EMAIL PROTECTED]> writes: >>> >>> use File::Glob ':glob'; >>^^^ >> Note that the only options available are ':case', ':nocase' and >> ':globally', > > Maybe it recognizes the abbrev or something. Doesn't seem to be > wreaking havoc a

Re: confused with File::Glob

2003-02-09 Thread Harry Putnam
"John W. Krahn" <[EMAIL PROTECTED]> writes: >> cat ./testglob.pl >> #!/usr/local/bin/perl -w >> >> use File::Glob ':glob'; >^^^ > Note that the only options available are ':case', ':nocase' and > ':globally', Maybe it recognizes the abbrev or something. Doesn't seem t

Re: confused with File::Glob

2003-02-08 Thread John W. Krahn
Harry Putnam wrote: > > Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> writes: > > > And || enforces scalar context, so func() won't (can't) return a list, in > > your case. > > Thanks, I'd have been a very long time figuring that out... Another point. > cat ./testglob.pl > #!/usr/local/bin/perl -w

Re: confused with File::Glob

2003-02-08 Thread Harry Putnam
Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> writes: > And || enforces scalar context, so func() won't (can't) return a list, in > your case. Thanks, I'd have been a very long time figuring that out... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: confused with File::Glob

2003-02-08 Thread Jeff 'japhy' Pinyan
On Feb 8, Harry Putnam said: > @files = bsd_glob("$glob_pattern",GLOB_ERR)|| die "Yikes: $!"; This line screws you up. Change the || to 'or'. @files = bsd_glob(...) or die "Yikes: $!"; The reason being: || binds very tightly, and 'or' binds less tightly. With ||, your code is like @file

Re: Confused by a complex data structure

2002-12-15 Thread John W. Krahn
Rob Richardson wrote: > > Hello again. Hello, > None of this is working. > > John Krahn suggested: > > push @{$trainsList{$trainDate}}, @trainData; > (note the curly brackets on the outside). This gave me the following > error: > > Can't locate object method "trainList" via package "train

Re: Confused by a complex data structure

2002-12-15 Thread Rob Richardson
Hello again. None of this is working. John Krahn suggested: > push @{$trainsList{$trainDate}}, @trainData; (note the curly brackets on the outside). This gave me the following error: Can't locate object method "trainList" via package "trainDate" (perhaps you forgot to load "trainDate"?) at

Re: Confused by a complex data structure

2002-12-15 Thread John W. Krahn
Rob Richardson wrote: > > Greetings! Hello, > I am trying to write a Perl script for the Cuyahoga Valley Scenic > Railroad, so that volunteers can sign up to work on trains. The > schedule file has comma-separated lines that have the date of the > train, the name of the train, and the names of

RE: Confused by a complex data structure

2002-12-14 Thread Beau E. Cox
Hi - Tell perl it really is an array: push @( $trainsList{$trainDate} }, $trainRef; ^^ ^ Aloha => Beau. -Original Message- From: Rob Richardson [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 14, 2002 3:35 PM To: [EMAIL PROTECTED] Subject: Confused b

Re: confused about perl and jpg

2002-03-28 Thread Wytch
"Agustin Rivera" <[EMAIL PROTECTED]> wrote in message 002201c1d6a9$4e8cec40$9865fea9@agustinr">news:002201c1d6a9$4e8cec40$9865fea9@agustinr... > You're right. I was thinking when I deemed a > valid tag. lol.. I guessed that was the case and felt a bit guilty after pressing the send button...

Re: confused about perl and jpg

2002-03-28 Thread Agustin Rivera
You're right. I was thinking when I deemed a valid tag. "Agustin Rivera" <[EMAIL PROTECTED]> wrote in message 000d01c1d6a3$f7e83c50$9865fea9@agustinr">news:000d01c1d6a3$f7e83c50$9865fea9@agustinr... > Your html tag is misformatted for starters. > > try > > print " "; > or > print " "; > > I h

Re: confused about perl and jpg

2002-03-28 Thread Wytch
"Agustin Rivera" <[EMAIL PROTECTED]> wrote in message 000d01c1d6a3$f7e83c50$9865fea9@agustinr">news:000d01c1d6a3$f7e83c50$9865fea9@agustinr... > Your html tag is misformatted for starters. > > try > > print " "; > or > print " "; > > I have no idea if the image is actually there, however :) Actu

Re: confused about perl and jpg

2002-03-28 Thread Agustin Rivera
Your html tag is misformatted for starters. try print " "; or print " "; I have no idea if the image is actually there, however :) Regards, Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: "Jerry Preston" <[EMAIL PROTECTED]> To: "begginners"

RE: confused over cookbook example 6-2

2001-08-10 Thread Bob Showalter
> -Original Message- > From: Cohan, Drew [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 10, 2001 8:32 AM > To: '[EMAIL PROTECTED]' > Subject: confused over cookbook example 6-2 > > > I'm trying to modify cookbook example 6-2: > > #killtags: very bad html tag killer > undef $/; > whil

Re: confused over cookbook example 6-2

2001-08-10 Thread Jos I. Boumans
are you sure your input is what you expect it to be? maybe print out all the lines? and if you like, i wrote a very basic and simple html parser. you can get it here: http://japh.nu/index.cgi?base=modules take a look at the source, it should probably explain a lot hth Jos > I'm trying to modi

Re: Confused

2001-07-05 Thread Peter J. Scott
At 08:41 PM 7/4/01 -0500, RL Autry wrote: >A friend of mine sent me a file to write > to help get me started on programming Perl. >So I did (in notepad): > >#!/usr/bin/perl -w >use strict; >while (<>) { >if ( /book/i or /bk/i) { >print; >} > >When I run it in my dos window -- > I get an error m

Re: Confused

2001-07-04 Thread RL Autry
At 09:55 PM 7/4/2001, Tim Musson wrote: >Hey RL, > >Wednesday, July 04, 2001, 9:41:19 PM, my MUA believes you used >QUALCOMM Windows Eudora Version 5.1 to write: > > >snip -- > >RA> When I run it in my ActivePerl.exe window -- >RA> nothing happens. > >Not sure what that is... Did you get you

Re: Confused

2001-07-04 Thread Tim Musson
Hey RL, Wednesday, July 04, 2001, 9:41:19 PM, my MUA believes you used QUALCOMM Windows Eudora Version 5.1 to write: snip -- RA> When I run it in my ActivePerl.exe window -- RA> nothing happens. Not sure what that is... Did you get your "ActivePerl.exe" window by running perl.exe from W

Re: Confused

2001-07-04 Thread Jeff 'japhy' Pinyan
On Jul 4, RL Autry said: >By the way is everyone getting two for one emails or just me? You're getting two when people reply to you. That's because many mail clients will reply to the originator of the email, as well as the people being Cc'ed, which includes this list. And you get a copy from

Re: Confused

2001-07-04 Thread RL Autry
At 08:47 PM 7/4/2001, Daniel Dwyer wrote: >#!/usr/bin/perl -w > use strict; > while (<>) { > if ( /book/i or /bk/i) { > print; > } >}#missing this one Ok I get it so for every bracket I have to have an ending bracket. Very good thanks. By the way is everyone getting two for one emails or ju

Re: Confused

2001-07-04 Thread Daniel Dwyer
> A friend of mine sent me a file to write > to help get me started on programming Perl. > So I did (in notepad): > > #!/usr/bin/perl -w > use strict; > while (<>) { > if ( /book/i or /bk/i) { > print; > } > Missing right curly or square bracket at findit.pl line 6, at end of line > syntax erro

Re: confused

2001-06-08 Thread Me
First, some background. There are several fundamentally different ways in which a perl script can be run, including: 1. At a shell prompt / command line. 2. As a CGI (there are various others.) Each of these has its own "environment" in which a running script runs. These environments