[29501] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 745 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 11 11:09:43 2007

Date: Sat, 11 Aug 2007 08:09:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 11 Aug 2007     Volume: 11 Number: 745

Today's topics:
    Re: Coding in Perl <bik.mido@tiscalinet.it>
    Re: form script question <rvtol+news@isolution.nl>
    Re: Help: Newbie Question <openlinuxsource@gmail.com>
    Re: Help: Newbie Question <openlinuxsource@gmail.com>
    Re: how to tranpose a huge text file <jiehuang001@gmail.com>
    Re: Need help writing a basic script print to text file <bill@ts1000.us>
    Re: Need help writing a basic script print to text file <nobull67@gmail.com>
    Re: pass by reference <bik.mido@tiscalinet.it>
    Re: pass by reference <bik.mido@tiscalinet.it>
    Re: Perl script to track UPS packages by tracking numbe QoS@domain.invalid
    Re: Perl script to track UPS packages by tracking numbe <Peter@PSDT.com>
    Re: Question on grep and reading from file <pinaki_m77@yahoo.com>
    Re: Question on grep and reading from file <peter@makholm.net>
    Re: Replacing a line <vedpsingh@gmail.com>
    Re: The Modernization of Emacs: keyboard shortcuts pain <xah@xahlee.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 11 Aug 2007 16:51:59 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Coding in Perl
Message-Id: <9eirb3lod9k613oqth079h5cigh47jtg39@4ax.com>

On Fri, 10 Aug 2007 18:06:55 -0000, usenet@DavidFilmer.com wrote:

>On Aug 10, 2:38 am, Michele Dondi <bik.m...@tiscalinet.it> wrote:
>> Depends on the period. I would rate my experience as average...
>
>Oh crap, then I need to seriously reassess my own experience level...

Well, that's just what's fair. I've been playing with Perl for years,
but even staying more or less within the realms of the language
proper, there are areas of it with which I'm familiar and even
proficient while there are others I hardly know: just take into
account e.g. OO intricacies and other delicate stuff, like features
recently introduced that I did never really delve into e.g. attributes
etc. But when we come to applications it's even more so: I mostly do
simple text transformations and system-utility like stuff... OTOH at
work I had to deal with databases and with the help of coworkers I
managed to do so... but never really "got into it" and I wouldn't know
where to start should I do that again now. (Not true: I would know
*where* to start, but it would be the *very* start, and of a steep
road.) Similarly when people post here discussions about managing
sockets I tend to save their articles because I always think: one day
I must become a guru with this kinda stuff; but always fail to do
so... since I've not to deal with it for personal interests and...
well you don't put into practice those things you learnt.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Sat, 11 Aug 2007 16:54:47 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: form script question
Message-Id: <f9kpsa.1d8.1@news.isolution.nl>

David Pyles schreef:

> $homedir || $vdeck->fatal_error("Can't determine home directory");

That line seems to have to be moved up about 8 lines. 

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

Date: Sat, 11 Aug 2007 15:30:50 +0800
From: Amy Lee <openlinuxsource@gmail.com>
Subject: Re: Help: Newbie Question
Message-Id: <pan.2007.08.11.07.30.45.278970@gmail.com>

On Fri, 10 Aug 2007 20:56:46 +0200, Mirco Wahab wrote:

> Amy Lee wrote:
>> In our Bioinformatics Department, we need to convert some files into a
>> suitable formation. 
>> The original formation is:
>>> 16jh_0101.b1.abi  Chromat File {descriptions......}
>> ATCCGTACTGC............................................
> 
> This looks like a fairly standard fasta format,
> which would look like:
>     12345678901234567890 . . . . . . . . . . .. . . . . . . .  60c
>     ------------------------------------------------------------
> 1| > 16jh_0101.b1.abi  Chromat File descriptions [\n]
> 2| ATCCGTACTGCATCCGTACTGCATCCGTACATCCGTACTGCATCCGTACTGCATCCGTAC[\n]
> 3| (more sequence until the next "\n>" record tag
> 
>> I hope that it can be this:
>>> 16>jh_0101>ATCCGTACTGC............................................
>> 
>> In one file, there are many template like above, so I need a script can
>> solve the problem.
> 
> Which problem? To convert the fasta header
> from "> 16jh_0101.b1.abi ... \nATCCG..."
> to   "> 16>jh_0101>ATCCG"
> 
> 
> What exactly is the "problem" you are trying to solve?
> 
> Regards
> 
> M.

Hi,

My problem is how use Perl to convert the fasta header from 
> 16jh_0101.b1.abi Chromat File descriptions [\n]
> 2| ATCCGTACTGCATCCGTACTGCATCCGTACATCCGTACTGCATCCGTACTGCATCCGTAC[\n]
> 3| (more sequence until the next "\n>" record tag

to
16>jh_0101>ATCCGTACTGC............................................

Thank you very much, I hope that I can get the code.

Regards,

Amy Lee


------------------------------

Date: Sat, 11 Aug 2007 15:33:57 +0800
From: Amy Lee <openlinuxsource@gmail.com>
Subject: Re: Help: Newbie Question
Message-Id: <pan.2007.08.11.07.33.56.365316@gmail.com>

On Fri, 10 Aug 2007 11:03:14 -0500, Ted Zlatanov wrote:

> On Fri, 10 Aug 2007 14:19:27 +0200 Josef Moellers <josef.moellers@fujitsu-siemens.com> wrote: 
> 
> JM> Amy Lee wrote:
>>> Hi, all
>>> 
>>> I'm a newbie in Perl,
> 
> JM> Yes ... and?
> 
>>> and I have to make a Perl script that can solve the
>>> question.
> 
> JM> Yes ... and? What have you tried so far? You write "_I_ have to make ...".
> JM> The department for ready-made scripts is at www.cpan.org, although
> JM> they only stock off-the shelf scripts and script snippets called
> JM> modules. Tailor-made scripts can be obtained by hiring a developer.
> 
> JM> This department only serves to help when you have problems with a
> JM> certain script ("I tried <thisandthat> and expected <suchandsuch> but
> JM> got <somethingelse>") or it keeps people entangled in endless debates
> JM> about The True Way ;-)
> 
> I think this was fairly rude (not that it's unusual on c.l.p.m in the
> last few years).  At least point the OP in the right direction.  I'll
> follow up to her question separately.
> 
> Ted

Ted,

Thanks your patience. I suppose that I have no brilliant in coding. So if
I post some "stupid" questions, please do not angry. 

*^_^*

Thank you very much~

Regards,

Amy Lee



------------------------------

Date: Sat, 11 Aug 2007 15:08:15 -0000
From:  Jie <jiehuang001@gmail.com>
Subject: Re: how to tranpose a huge text file
Message-Id: <1186844895.953259.318160@q4g2000prc.googlegroups.com>


I really appreciate all the reponses here!!

I did not jump in because I want to test each proposed solution first
before providing any feedback.

I will definitely try to understand and test all the solutions and let
everybody know what I got.

Thank you guys so much!

Jie

On Aug 10, 7:31 pm, Ted Zlatanov <t...@lifelogs.com> wrote:
> On Fri, 10 Aug 2007 22:28:34 +0000 (UTC) Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
>
> IZ> [A complimentary Cc of this posting was sent to
> IZ> Ted Zlatanov
> IZ> <t...@lifelogs.com>], who wrote in article <m2absz82te....@lifelogs.com>:>> >> Now you can write each inverted output line by looking in break.txt,
> >> >> reading every line, chomp() it, and append it to your current output
> >> >> line if it's divisible by 1000 (so 0, 1000, 2000, etc. will match).
> >> >> Write "\n" to end the current output line.  
>
> IZ> Good.  So what you suggest, is 1000 passes over a 4GB file.  Good luck!
>
>
>
> >> I suggested a database, actually.
>
> IZ> And why do you think this would decrease the load on head seeks?
> IZ> Either the data fits in memory (then database is not needed), or it is
> IZ> read from disk (which would, IMO, imply the same amount of seeks with
> IZ> database as with any other file-based operation).
>
> Look, databases are optimized to store large amounts of data
> efficiently.  You can always create a hand-tuned program that will do
> one task (e.g. transposing a huge text file) well, but you're missing
> the big picture: future uses of the data.  I really doubt the only thing
> anyone will ever want with that data is to transpose it.
>
> IZ> One needs not a database, but a program with build-in caching
> IZ> optimized for non-random access to 2-dimensional arrays.  AFAIK,
> IZ> imagemagick is mostly memory-based.  On the other side of spectrum,
> IZ> GIMP is based on tile-caching algorithms; if there were a way to
> IZ> easily hook into this algorithm (with no screen display involved), one
> IZ> could handle much larger datasets.
>
> You and everyone else are overcomplicating this.
>
> Rewrite the original input file for fixed-length records.  Then you just
> need to seek to a particular offset to read a record, and the problem
> becomes transposing a matrix piece by piece.  This is fairly simple.
>
> IZ> Yet another way might be compression; suppose that there are only
> IZ> (e.g.) 130 "types" of entries; then one can compress the matrix into
> IZ> 1GB of data, which should be handled easily by almost any computer.
>
> You need 5 bits per item: it has 16 possible values ([ACTG]{2}), plus
> "--".
>
> A database table, to come back to my point, would store these items as
> enums.  Then you, the user, don't have to worry about the bits per item
> in the storage, and you can just use the database.
>
> Ted




------------------------------

Date: Sat, 11 Aug 2007 02:09:24 -0700
From:  Bill H <bill@ts1000.us>
Subject: Re: Need help writing a basic script print to text file
Message-Id: <1186823364.377154.281330@r34g2000hsd.googlegroups.com>

On Aug 10, 9:46 pm, "Petr Vileta" <sto...@practisoft.cz> wrote:
> Bill H wrote:
> > Heres a brute force example:
>
> > $filename = time();
> > $filename += ".txt";
>
> Yes, really very brute :-)
>
>     $filename += ".txt";
> should be
>     $filename .= ".txt";
> or simple
>     $filename = time . '.txt';
>
> --
>
> Petr Vileta, Czech republic
> (My server rejects all messages from Yahoo and Hotmail. Send me your mail
> from another non-spammer site please.)

You are right Petr. Thats what I get for typing code I cant test :)

Bill H



------------------------------

Date: Sat, 11 Aug 2007 13:28:18 -0000
From:  Brian McCauley <nobull67@gmail.com>
Subject: Re: Need help writing a basic script print to text file
Message-Id: <1186838898.520420.261460@o61g2000hsh.googlegroups.com>

On Aug 11, 1:21 am, Bill H <b...@ts1000.us> wrote:

[ A Perl4 script ]

> It's missing a bunch of things,

Yes, sure is.

Showing newbies how to write for Perl4 isn't really a very nice thing
to do.  No point learning stuff you'll have to unlearn.




------------------------------

Date: Sat, 11 Aug 2007 11:15:47 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: pass by reference
Message-Id: <4hvqb3pcts5au5a82goso4o2s2of5rt9ie@4ax.com>

On 10 Aug 2007 09:32:47 -0500, Lawrence Statton
<yankeeinexile@gmail.com> wrote:

>> In English, it's "it".
>
>In English.pm it's "$ARG" ...  :) 

No, that's "useless quoting of variables"...


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Sat, 11 Aug 2007 11:47:29 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: pass by reference
Message-Id: <3d1rb35sjf75gv7h13cjp0mqjgm10smj70@4ax.com>

On Sat, 11 Aug 2007 11:15:47 +0200, Michele Dondi
<bik.mido@tiscalinet.it> wrote:

>>In English.pm it's "$ARG" ...  :) 
>
>No, that's "useless quoting of variables"...

I forgot to add  :-p


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Sat, 11 Aug 2007 12:14:12 GMT
From: QoS@domain.invalid
Subject: Re: Perl script to track UPS packages by tracking number.
Message-Id: <oKhvi.173$hK5.66@trndny02>


Ignoramus22443 <ignoramus22443@NOSPAM.22443.invalid> wrote in message-id:  <jvWdnT_1XJfxvSDbnZ2dneKdnZydnZ2d@giganews.com>

> 
> To interrupt our usual patterns of worthless spams
> (alt.marketing.online.ebay) or making snide remarks
> (comp.lang.perl.misc), here is a useful perl script for tracking UPS
> packages. 
> 
> To run it on command line, you give it a list of UPS tracking numbers
> (no spaces inside the numbers). You can append a comment (no spaces
> after a "/" character to each tracking number. 
> 
> Example: 
> 
> ups-track.pl 1Z903475387458375/Newegg 1Z387847878676764/Fred 1Z938983989489898
> 
> 
> It prints something like this:
> 
> 1Z1467XF0366666414      Toshiba-2.2-kW Status: In Transit - On Time Scheduled: 08/14/2007 Weight: 13.00 Lbs
> 1Z1467XF0346652024      Toshiba-3.7-kW Status: In Transit - On Time Scheduled: 08/14/2007 Weight: 15.00 Lbs
> 1ZA4Y0130366628290           DinoRight Status: In Transit - On Time Scheduled: 08/14/2007 Weight: 12.00 Lbs
> 1Z2R899R0355530175         Bargainland Status: In Transit
> 1Z2R899R0315555584                     Status: In Transit
> 
> #!/usr/bin/perl
> ######################################################################
> # perl script for tracking UPS  packages.  
>  
> # To run it on command line, you give it a list of UPS tracking numbers 
> # (no spaces inside the numbers). You can append a comment (no spaces 
> # after a "/" character to each tracking number.  
> #
> # Example:  
> #
> # ups-track.pl 1Z903475387458375/Newegg 1Z387847878676764/Fred 1Z938983989489898 
> #
> # Copyright 2007 Igor Chudov ichudov@algebra.com
> # Released under GNU GPL version 3.
> #
> ######################################################################
> 
> use strict;
> use warnings;
>  
> use vars qw( $ua );
>  
> 
> use LWP::UserAgent;
> use HTTP::Request::Common;
> use HTML::TreeBuilder;
> 
> #use Data::Dumper;
>  
> $ua = LWP::UserAgent->new;
> 
> #$cookies = new HTTP::Cookies( file => "cookies.txt", autosave => 1 );
> 
>  
> 
> sub make_tree {
>   my ($html) = @_;
>   my $tree = HTML::TreeBuilder->new;
>   $tree->parse( $html );
>   return $tree;
> }
> 
>  
> 
> sub get_request {
>   my ($req) = (@_);
>   #$cookies->add_cookie_header($req);
>   my $res = $ua->request($req);
>   if ($res->is_success) {
>     #$cookies->extract_cookies($res);
>     return $res;
>   } else {   
>     print STDERR "Failed to execute HTTP request: ", $res->status_line,
> 
>     print STDERR $res->as_string;
>   }
> 
>   return undef;
> 
> }
> 
>  
> 
> sub get_webpage {
>   my ($url) = @_;
>   my $req = HTTP::Request->new(GET => $url);
>   
>   my $result = get_request( $req );
>  
>   if( !$result ) {
>     print STDERR "Failed to get url '$url'.\n";
>   }
>  
>   return $result;
> }
> 
> 
> 
> my $usage = "USAGE: $0 tracknum";
> 
> foreach my $track (@ARGV) {
>   my $comment = "";
>   $comment = $1 if $track =~ s#/(.*)$##;
> 
>   my $url = "http://wwwapps.ups.com/WebTracking/processInputRequest?sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=en_US&InquiryNumber1=$track&track.x=0&track.y=0";
>     
>   my $text = get_webpage( $url )->as_string;
> 
>   my $tree = make_tree( $text );
> 
>   #$tree->dump;
> 
>   my @table = $tree->look_down( '_tag',
>                                 'table', 
>                                 sub {
>                                   return $_[0]->as_text =~ /Status:/;
>                                 }
>                               );
>   #print Dumper( @table );
>   my $table = pop @table;
> 
>   #print Dumper( $table );
>   #exit 0;
>   
>   my $t = $table->as_HTML;
> 
>   my @rows = $table->content_list;
>   my $item = {};
>   foreach my $row (@rows) {
>     #print "ROW=$row.\n";
>     #$row->dump; print "\n================================\n";
>     next unless ref( $row );
>     my @cols = $row->content_list;
>     next unless 2 <= @cols;
>     my ($key, $value) = ($cols[0]->as_text, $cols[1]->as_text);
> 
>     $key =~ s/^\s+//; $key =~ s/\s+$//; $key =~ s/ +/ /g; $key  =~ tr/\x80-\xFF//d;
>     $value =~ s/^\s+//; $value =~ s/\s+$//; $value =~ s/ +/ /g; $value  =~ tr/\x80-\xFF//d;
>     
>     #print "$key=>$value.\n";
>     next unless $key =~ /(.*):$/;
>     $key = $1;
>     $item->{$key} = $value;
>   }
> 
>   print "$track";
>   print sprintf( " %19s", $comment );  
>   print " Status: $item->{Status}"                  if defined $item->{Status};
>   print " Scheduled: $item->{'Scheduled Delivery'}" if defined $item->{'Scheduled Delivery'};
>   print " Weight: $item->{Weight}"                  if defined $item->{Weight};
>   print "\n";
> 
>   if( 0 ) {
>     foreach my $k (sort keys %$item ) {
>       print "\t\t$k ==> $item->{$k}\n";
>     }
>     print "\n";
>   }
> }

Cool thanks!  Hey why not POD this and PAUSE it up to CPAN for everyone to see?



------------------------------

Date: Sat, 11 Aug 2007 13:04:54 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: Perl script to track UPS packages by tracking number.
Message-Id: <pan.2007.08.11.13.04.51.390997@PSDT.com>

On Sat, 11 Aug 2007 12:14:12 +0000, QoS wrote:
[Program to do UPS tracking snipped]
> Cool thanks!  Hey why not POD this and PAUSE it up to CPAN for everyone to see?

Better yet, submit a patch so that Business::UPS starts working again.

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



------------------------------

Date: Sat, 11 Aug 2007 01:07:24 -0700
From:  googler <pinaki_m77@yahoo.com>
Subject: Re: Question on grep and reading from file
Message-Id: <1186819644.647323.193040@d55g2000hsg.googlegroups.com>

> > I have another question. Is there a way to read a particular line in a
> > file when I know the line number (without using a loop and reading
> > each line at a time)? I guess the below code would work.
> > @lines = <MYFILE>;
> > $myline = $lines[$linenum-1];
> > But this will read the entire file into the array @lines and can take
> > up a lot of memory if the file is huge. Is there a more efficient
> > solution?
>
> Unless you know how long each line is, or have otherwise pre-computed some
> kind of index into the file, you need to read the entire file at least up
> to the desired line and count newlines, either implicitly or explicitly.

OK, say I know how long each line is. How can it help in reading the n-
th line from the file directly? Can you please explain. Thanks.



------------------------------

Date: Sat, 11 Aug 2007 08:27:24 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: Question on grep and reading from file
Message-Id: <87ir7mh3wz.fsf@hacking.dk>

googler <pinaki_m77@yahoo.com> writes:

>> Unless you know how long each line is, or have otherwise pre-computed some
>> kind of index into the file, you need to read the entire file at least up
>> to the desired line and count newlines, either implicitly or explicitly.
>
> OK, say I know how long each line is. How can it help in reading the n-
> th line from the file directly? Can you please explain. Thanks.

If you know that each line, including newline, is $x bytes long, you
can read line $n by doing something like: 

    use Fcntl (:seek);

    open FH, '>', $filename;
    seek FH, $n*$x, SEEK_SET;
    $_ = <FH>;

Note that the length is in bytes, not characters. So doing this on an
utf8 encoded file (or any other variable length encoding) will not
work as expected.

//Makholm


------------------------------

Date: Sat, 11 Aug 2007 06:16:52 -0700
From:  Ved <vedpsingh@gmail.com>
Subject: Re: Replacing a line
Message-Id: <1186838212.955597.125390@i13g2000prf.googlegroups.com>

On Aug 9, 5:38 am, Tad McClellan <ta...@seesig.invalid> wrote:
> Ved <vedpsi...@gmail.com> wrote:
>
> [ Please learn to compose followups properly.
>   Quoting 100 lines to add 2 lines will make you go invisible...
> ]
>
> > Why is it not entering in this condition ?
>
> >  if( m{^//#define \$module_nameFileLoadInput 1$} )
>
> Probably because the string in $_ does not contain a '$' followed
> by an 'm' followed by an 'o' followed by a 'd'...
>
> You should attempt to write a short and complete program that we
> can run that illustrates your problem.
>
> Have you seen the Posting Guidelines that are posted here frequently?
>
> ------------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> $_ = '//#define BBPRxChanRouteFileLoadInput 1';
> my $module_name = 'BBPRxChanRoute';
> if( m{^//#define ${module_name}FileLoadInput 1$} )
>     { print "true\n" }
> else
>     { print "false\n" }
> ------------------------------
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


Hi Tad and Gleixner,
Thanks for the replies.
Tad I will be more adherant to the guidelines in future.

Now the code looks like this:
################################################################
#!/usr/local/bin/perl
#use strict;
use warnings;
use Tie::File;

my $cpp_file_list = 'my.rxfiles';
    open my $fh,'<',$cpp_file_list or die "Cannot read $cpp_file_list:
$!\n";
    while (my $cpp_file = <$fh>) {
         chop $cpp_file;
     our $module_name = "$cpp_file";
    # my  $module_name = "$cpp_file";
	$module_name =~ s/\.cpp$//;#removing trainling .cpp
      print "this is name $module_name\n";
      print "this is CPP $cpp_file\n";
     if (-e $cpp_file) {
       process_one_file($cpp_file);
     } else {
       warn "File $cpp_file does not exist; skipping\n";
     }
   }

   #Using core module Tie::File to process a file in this subroutine
   sub process_one_file {
     my $cpp_file = shift;
     print "Processing $cpp_file\n";
      tie my @array, 'Tie::File', $cpp_file  or die "tie error
$cpp_file: $!\n" ;

 for (@array) #Each line should come one by one
	 {
	if( m{^//#define ${module_name}FileLoadInput 1$} )
	    { print "true $module_name \n"
                        s{^//}{};  # Is something wrong here ?
        	}
	else
	    #{ print "false\n" }
	    { print "false $module_name \n"}

         }


 }

############## my.rxfiles contains this   ###############
abc.cpp


############### abc.cpp contains this  ###########
//#define abcFileLoadInput 1
// #define abcFileLoadInput 1

##################################################
##################################################
PROBLEM (1)
Now when I use "strict" I am getting following error:

Variable "$module_name" is not imported at rx_top_script.pl line 30.
Variable "$module_name" is not imported at rx_top_script.pl line 31.
Variable "$module_name" is not imported at rx_top_script.pl line 36.
Global symbol "$module_name" requires explicit package name at
rx_top_script.pl line 30.
Global symbol "$module_name" requires explicit package name at
rx_top_script.pl line 31.
Global symbol "$module_name" requires explicit package name at
rx_top_script.pl line 36.
###################
When I comment strict I am getting this which perfectly fine:
this is name abc
this is CPP abc.cpp
Processing abc.cpp
true abc
false abc
###################
PROBLEM(2)
I thought to ignore STRICT for the time being and try to achieve what
I desire.
So in the for loop I put the line :
  s{^//}{};
##################
But it gave me this error:
syntax error at rx_top_script.pl line 32, near "s{^//}{}"
##################

Do I need to rectify the STRICT issue(problem) to get rid of
PROBLEM(2) ?

If yes :
Is this the best link to solve PROBLEM(1) ?
http://www.perl.com/pub/a/2002/04/23/mod_perl.html

Or is there something even better?

Regards
Ved







------------------------------

Date: Sat, 11 Aug 2007 03:57:03 -0700
From:  Xah Lee <xah@xahlee.org>
Subject: Re: The Modernization of Emacs: keyboard shortcuts pain
Message-Id: <1186829823.834012.198770@z24g2000prh.googlegroups.com>

The following is a FAQ from emacs modernization
http://xahlee.org/emacs/modernization.html

Q: Emacs's undo is superior, because the prevalent Undo/Redo system
actually loss info.

A: Emac's undo is very confusing and does not have a Redo command. To
redo after a undo, people are told to type something then do a undo.
Long time emacs user argue that it is technically superior because it
lets user to revert to any possible state of the past.

A practical problem with the way of emacs undo is that it repeats the
states in the action record. In the prevalent undo model, the action
record is linear, and each entry is unique. A user can easily arrive
at a desired previous state using undo and redo. In emacs's model, it
traverses the queue back and forth (or add existing states to the
stack). It is hard for a user to know when to do undo or do "some
random typing followed by undo" to get to the state he wants. In
particular, once a person did more than once of "some random typing
followed by undo", the undo record becomes too convoluted for a person
to keep in mind and often the undo action becomes useless at that
point.

If you take a survey among programers who use emacs for at least 1
year, perhaps more than 90% are confused by emacs's undo model and do
not find it useful. If you take a survey of software users other than
emacs, i do not think anyone will report their software's undo lacks
something to be desired.

It is reasonable to argue, that people work better with a simple undo/
redo model. Undo is practically used to erase a mistake or doing a
simple one-time revision. Once a user did a sequence of undos and
redos, we can assume that he arrived at a satisfactory point and
intends to start fresh from that point. If he needs extra revision
control, a more proper mechanism, one that people actually use, is to
revert to the saved version.

  Xah
  xah@xahlee.org
  http://xahlee.org/



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 745
**************************************


home help back first fref pref prev next nref lref last post