"John W. Krahn" wrote:
> "R. Joseph Newton" wrote:
> >
> > "Leaw, Chern Jian" wrote:
> > >
> > > $currDir = `pwd`;
> > > chomp($currDir);
> >
> > Don't use chomp here. The chomp function is for situations where
> > you may not know whether a line is terminated by a newline. You
> > just assigned
John W. Krahn wrote:
The output from running a command in backticks will have newlines although
in scalar context it could have more then just one at the end.
$ perl -le'$x = `pwd`; print $x =~ tr/\n//; $x = `ls -l`; print $x =~ tr/\n//;'
1
236
In other words 1 line ending for 'print working dir
"R. Joseph Newton" wrote:
>
> "Leaw, Chern Jian" wrote:
> >
> > $currDir = `pwd`;
> > chomp($currDir);
>
> Don't use chomp here. The chomp function is for situations where
> you may not know whether a line is terminated by a newline. You
> just assigned a value to pwd, so it is pointless to the
"Leaw, Chern Jian" wrote:
> HI,
> I would like to change output format of a file from:
> ...
> to the format listed below when printing it out to the standard output:
>
> abinabdu
> ...
> Each elements in the file are sepated by 1 or more spaces (see attached file).
>
> The script written below a
WC -Sx- Jones wrote:
And ... if you change this line:
next unless $word =~ /\w/;
To -
next unless $word =~ /^\w{5}$/;
It will only find 5 letter words...
Truly sorry now - I'll go back into hibernation.
-Bill-
__Sx__
http://youve-reached-the.
[mailto:[EMAIL PROTECTED]
Sent: Saturday, February 28, 2004 5:52 PM
To: [EMAIL PROTECTED]
Subject: Re: Changing file output format
Chern Jian Leaw wrote:
>
> HI,
Hello,
> I would like to change output format of a file from:
> abinabdu adanie2 agibson agoh1aiabouse
>
WC -Sx- Jones wrote:
Grrr, I forgot about MANY files:
my @files = @ARGV ? @ARGV : die "I need at least one filename argument\n\n";
foreach my $filetarget (@files) {
open (FHANDLE, "<$filetarget") or die "owie, cannot open $filetarget";
my %count;
while () {
for my $word (split) {
Chern Jian Leaw wrote:
>
> HI,
Hello,
> I would like to change output format of a file from:
> abinabdu adanie2 agibson agoh1aiabouse
> akko alau alee1alee2amitb
> amohdali amshams anmohand
>
> to the format listed below when printing it out to the standard output:
>
> a
=pod
Leaw, Chern Jian wrote:
to the format listed below when printing it out to the standard output:
abinabdu
adanie2
agibson
agoh1
aiabouse
akko
alau
alee1
alee2
amitb
amohdali
amshams
anmohand
my %count;
while () {
for my $word (split) {
next unles