Re: perl newbie question

2005-07-25 Thread FreeFall
try: perl -ne '$line=$_;END{print $line}' yourfile On Mon, 25 Jul 2005 19:09:50 +0530 [EMAIL PROTECTED] wrote: hi , I am a perl newbie. Can someone suggest a perl command line snippet that will print the last n lines of a file. thanks in advance. regards, Kaushik Notice:

Re: What does this error message mean?

2005-06-12 Thread FreeFall
On Sun, 12 Jun 2005 11:49:37 -0700 (PDT) Christopher Spears [EMAIL PROTECTED] wrote: I am trying to update a script I wrote to automate g++. Here is an excerpt: #!/bin/perl -w use strict; my $number_of_args = @ARGV; open STDERR, ./caught_errors or die Can't create caught_errors:

Re: How to change the value of a Hash Key

2005-06-08 Thread FreeFall
The following code may be not simple: ===code=== #!/usr/bin/perl use warnings; use strict; my %hash = (abc=mallik,xyz=ariun,mno=priya); my %hash2 = (abc=123,xyz=243,mno=532); foreach (keys %hash2) { $hash{$hash2{$_}} = $hash{$_}; delete $hash{$_}; } foreach (keys %hash) { print $_ ==

Re: problem with assigning a value

2005-06-07 Thread FreeFall
perldoc -f glob maybe will help: On Tue, 7 Jun 2005 14:13:29 -0700 Vladimir Lemberg [EMAIL PROTECTED] wrote: glob (*.vsn) -- Whatever you do will be insignificant,but the important is you do it! It doesn't matter who you are, it's what you do that takes you far! -- To unsubscribe,

Re: about substring

2005-05-10 Thread FreeFall
Or you can try: __BEGIN__ #!/usr/bin/perl use warnings; use strict; my @decimals; $_ = 'atom 12 N VAL A 1 12.435 13.66 34.6 32.1 32 a N'; push @decimals,$1 while (/(\d+\.?\d*)/g); print @decimals\n; __END__ On Mon, 9 May 2005 19:04:08 +0530 Aditi Gupta [EMAIL PROTECTED] wrote: Hi

Re: about substring

2005-05-10 Thread FreeFall
On Tue, 10 May 2005 09:22:31 +0200 John Doe [EMAIL PROTECTED] wrote: my @decimals= /(\d+\.?\d*)/g; cool! Thanks! -- Whatever you do will be insignificant,but the important is you do it! It doesn't matter who you are, it's what you do that takes you far! -- To unsubscribe, e-mail: [EMAIL

Re: WhiteSpace - Map, search replace, split

2005-04-21 Thread FreeFall
On Thu, 21 Apr 2005 08:31:27 +0300 Offer Kaye [EMAIL PROTECTED] wrote: On 4/21/05, FreeFall wrote: 3. But there's an even easier way, without having to use map: my @record = split /\s*\|\s*/,$date; --this seems it cant delete spaces of the last element. Have you tried

Re: WhiteSpace - Map, search replace, split

2005-04-21 Thread FreeFall
On Thu, 21 Apr 2005 10:06:24 +0300 Offer Kaye [EMAIL PROTECTED] wrote: On 4/21/05, FreeFall wrote: Sure I did with Paul's example data : $date = 'one | two |three |'; And I tried to change the regx /\s*\|\s*/ to /s*\|?\s*/ and it worked. What do you think? I think that's

Re: WhiteSpace - Map, search replace, split

2005-04-20 Thread FreeFall
On Wed, 20 Apr 2005 17:04:50 +0300 Offer Kaye [EMAIL PROTECTED] wrote: On 4/20/05, Paul Kraus wrote: Why does this work my $date = 'one | two |three |'; my @record = map ( whitespace($_), (split /\|/,$_) ); No, it won't work - you need to replace the $_ at the end with

Re: HTML parsing

2005-03-30 Thread FreeFall
I am new to Perl too and have a little try: #!/usr/bin/perl use warnings; use strict; my @data; while () { chomp; push @data,$_ if !/^\/; } On Mon, 28 Mar 2005 15:49:38 -0500 Daniel Smith [EMAIL PROTECTED] wrote: Hi all, I'm brand new to Perl, and have just a