Thanks Chas. Working on this now...digging as much I can and updating some
thing new.
-Original Message-
From: Chas. Owens [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 16, 2008 4:06 AM
To: Manoj
Cc: Perl Beginners
Subject: Re: Info from flat file
On Fri, Mar 14, 2008 at 3:33 PM, Manoj
"John W. Krahn" schreef:
> Also the format "%2.0f" says to print the argument as a floating point
> number but not print the "floating point" part which is effectively
> the same as printing the argument as an integer using "%2d".
No, %d truncates, %f evens:
perl -wle'
printf("%1\$4.1f: %1\
Hi, as it is only my second week of perl I would be grateful for some
help with hashes. I need to build a list of multidimensional hashes
one by one, sort it by one of fields and iterate through it later.
1. building a hashes
sub t {
return {
a => 1,
b => 2,
}
}
sub r {
return (
Hi
I am unable to modify the input file ,
If I am redirecting output to with different file name it working fine
In want to replace name in a file
Script: problem
print " Enter the file Name \n";
$filename = ;
open(INPUT,"<$filename");
open(OUTPUT,">filename");
while()
Hi,
> I am unable to modify the input file ,
> If I am redirecting output to with different file name it working fine
> In want to replace name in a file
> $filename = ;
> open(OUTPUT,">filename");
As I understand, you want to modify $filename. so second line is
actually :
open(OUTPUT,">$filenam
Always start your code with:
use warnings;
use strict;
> my %record = r();
This line won't work. r() returns a reference (think pointer if you
used C) to a hash. You need a scalar to store it.
$record = r();
> $record{fieldA}{fieldB} = value...
This requires a hash, unlike the above line that use
While reading 'mastering perl', I run into @- and @+ for the first time.
Trying to understand what's going on, I ran the code from the book, but
$-[1] and $+[1] shoudln't match only the first match? (in this case,
shoudln't it be, 7 to 8 ?, instead of 7 to 9 ?)
--code--
#!/usr/bin/perl
$alphabet
Gowri Chandra Sekhar Barla, TLS, Chennai wrote:
Hi
Hello,
I am unable to modify the input file ,
If I am redirecting output to with different file name it working fine
In want to replace name in a file
Perl provides a way to do that. It is called the "in-place edit"
switch(-i)/variable
Richard Lee wrote:
While reading 'mastering perl', I run into @- and @+ for the first time.
perldoc perlvar
Trying to understand what's going on, I ran the code from the book, but
$-[1] and $+[1] shoudln't match only the first match? (in this case,
shoudln't it be, 7 to 8 ?, instead of 7 to
yitzle wrote:
Always start your code with:
use warnings;
use strict;
my %record = r();
This line won't work. r() returns a reference (think pointer if you
used C) to a hash. You need a scalar to store it.
$record = r();
Or dereference the reference returned from the sub:
my %record = %{ r()
John W. Krahn wrote:
Richard Lee wrote:
While reading 'mastering perl', I run into @- and @+ for the first time.
perldoc perlvar
Trying to understand what's going on, I ran the code from the book, but
$-[1] and $+[1] shoudln't match only the first match? (in this case,
shoudln't it be, 7 t
On Sun, Mar 16, 2008 at 12:54 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
> >> push @records, %record
> > I think you want an array of references, not of hashed themselves.
>
> Actually, the hash is converted to a list and that list is pushed onto
> the array.
>
>
> John
Darn! I tested it us
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
While reading 'mastering perl', I run into @- and @+ for the first time.
perldoc perlvar
Trying to understand what's going on, I ran the code from the book, but
$-[1] and $+[1] shoudln't match only the first match? (in this case,
Rob Dixon wrote:
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
While reading 'mastering perl', I run into @- and @+ for the first
time.
perldoc perlvar
Trying to understand what's going on, I ran the code from the book,
but
$-[1] and $+[1] shoudln't match only the first mat
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
While reading 'mastering perl', I run into @- and @+ for the first time.
perldoc perlvar
Trying to understand what's going on, I ran the code from the book, but
$-[1] and $+[1] shoudln't match only the first match? (in this case,
Richard Lee wrote:
Rob Dixon wrote:
Perhaps it would help to think of the offset as being the index of the
points between the characters, so the start of the string is at offset
zero, after 'a' (and before 'b') is at offset one and so on. Then can
you see how offset 7 is before 'hi' and offset
Rob Dixon wrote:
Richard Lee wrote:
Rob Dixon wrote:
Perhaps it would help to think of the offset as being the index of the
points between the characters, so the start of the string is at offset
zero, after 'a' (and before 'b') is at offset one and so on. Then can
you see how offset 7 is befor
Gowri Chandra Sekhar Barla, TLS, Chennai wrote:
I am unable to modify the input file ,
In addition to other posted solutions, I thought I'd mention the
possibility to open the file in read/write mode.
open my $FH, '+<', $filename or die $!;
my @lines = <$FH>;
truncate $FH, 0 or d
Gunnar Hjalmarsson wrote:
Gowri Chandra Sekhar Barla, TLS, Chennai wrote:
I am unable to modify the input file ,
In addition to other posted solutions, I thought I'd mention the
possibility to open the file in read/write mode.
open my $FH, '+<', $filename or die $!;
my @lines = <$FH
Jay Savage wrote:
On Mon, Mar 3, 2008 at 5:32 PM, David Newman <[EMAIL PROTECTED]> wrote:
Greetings. I'm looking to compare two contact lists in csv format, and
then print out "here are the records in in Llist only, in Rlist only,
and what's in common."
I should compare only 3 of the 82 fiel
20 matches
Mail list logo