Loading ...
Sorry, an error occurred while loading the content.

hashref concat..

Expand Messages
  • prakash
    one of my module has the following code... $sth = $dbh- prepare( select * from email where user_id= $userid and pros_email= $email ) || return
    Message 1 of 25 , Feb 3, 2003
    • 0 Attachment
      one of my module has the following code...

      $sth = $dbh->prepare("select * from email where user_id=\'$userid\' and
      pros_email=\'$email\'") || return $DBI::errstr;
      $sth->execute || return $DBI::errstr;
      $info=$sth->fetchrow_hashref('NAME_uc');
      $sth = $dbh->prepare("select * from category where
      cate_id=\'$info->{CATE_ID}\'") || return $DBI::errstr;
      $sth->execute || return $DBI::errstr;

      #########when i do this info before is over written.. i want to append...
      $info = $sth->fetchrow_hashref('NAME_uc');
      closeDB();
      ######### this works fine...
      $info->{ORG_USERNAME}=$obj->sElect("select org_username from category where
      cate_id=\'$info->{CATE_ID}\'");


      return $info;


      anybody have solution fo all all in the
    • prakash
      Hello All, is there a way to install perl version and forcing to keep the modules located already... i heard it is way to force to install latest version of
      Message 2 of 25 , Feb 24, 2003
      • 0 Attachment
        Hello All,

        is there a way to install perl version and forcing to keep the modules
        located already...

        i heard it is way to force to install latest version of modules ....

        but i want to keep the modules present.. since i hate to see errors in the
        exisiting applications..

        thanks..
        -prak
      • Madhu Reddy
        Hi, I have following sorting program... basically it will split the large files into small file and creates thread..each thread will sort files after that
        Message 3 of 25 , Feb 27, 2003
        • 0 Attachment
          Hi,
          I have following sorting program...
          basically it will split the large files into small
          file and creates thread..each thread will sort files
          after that merge back all sorted files...

          this program works fine on single CPU machine...
          same program giving problem on 8 CPU machine...

          the problem is , after creating the thread....
          one of the thread finishes the job...
          all other threads are still working....

          as soon as one thread finishes the job, i am getting
          perl application error (pops up small window)
          popup window contains following message...

          ======
          perl.exe application errorr

          The instruction at "0x2808335c" referenced memory at
          "0x00000004". The memory couldn't be written

          =======

          follwoing is output
          --------
          D:\Madhu\Sort_tmp>perl sort_new1.pl
          Thu Feb 27 14:37:00 2003 thread 1 Sorting chunk :
          tmp_1.txt
          Thu Feb 27 14:37:00 2003 thread 2 Sorting chunk :
          tmp_2.txt
          Thu Feb 27 14:37:00 2003 thread 3 Sorting chunk :
          tmp_3.txt
          Thu Feb 27 14:37:01 2003 thread 4 Sorting chunk :
          tmp_4.txt
          Thu Feb 27 14:37:05 2003 thread 5 Sorting chunk :
          tmp_5.txt
          Thu Feb 27 14:37:11 2003 thread 6 Sorting chunk :
          tmp_6.txt
          Thu Feb 27 14:37:17 2003 thread 7 Sorting chunk :
          tmp_7.txt
          Thu Feb 27 14:37:25 2003 thread 8 Sorting chunk :
          tmp_8.txt
          Thu Feb 27 14:37:34 2003 thread 9 Sorting chunk :
          tmp_9.txt
          Thu Feb 27 14:37:42 2003 thread 10 Sorting chunk :
          tmp_10.txt
          Thu Feb 27 14:37:51 2003 thread 11 Sorting chunk :
          tmp_11.txt
          Thu Feb 27 14:38:02 2003 thread 12 Sorting chunk :
          tmp_12.txt
          Thu Feb 27 14:38:14 2003 thread 13 Sorting chunk :
          tmp_13.txt
          Thu Feb 27 14:38:26 2003 thread 14 Sorting chunk :
          tmp_14.txt
          Thu Feb 27 14:38:44 2003 thread 14 Sorting chunk :
          tmp_14.txt COMPLETED
          **************
          here i am getting error ..following is message

          perl.exe application errorr

          The instruction at "0x2808335c" referenced memory at
          "0x00000004". The memory couldn't be written


          ***************
          ----------------

          any body have any idea ?
          following is my script

          ++++++++++++++++++++++
          #!C:\perl_5.8\bin\perl -w
          #use strict;

          use threads;
          use threads::shared;

          my $counter = 0;
          my @tmp_files;
          my @buffer;
          my %bounds:shared = ();
          my $i = 0;

          my $tm1 = &my_time();
          my $file = 'D:\Madhu\Tmp\abi_feeder.dat';
          open(FILE,$file) || die $!;
          while(<FILE>){

          push(@buffer,$_);
          if(@buffer > 1000000){
          $counter++;
          my $tmp = "tmp_$counter.txt";
          open(TMP,">$tmp") || die $!;
          for(@buffer){
          print TMP $_;
          }
          close(TMP);
          push(@tmp_files,$tmp);
          @buffer = ();
          }
          }

          if(@buffer){

          my $tmp = "tmp_" . ++$counter . ".txt";
          open(TMP,">$tmp") || die $!;
          for(@buffer){
          print TMP $_;
          }
          push(@tmp_files,$tmp);
          close(TMP);
          @buffer = ();
          }


          my @threads = ();
          for(@tmp_files){
          push(@threads, new threads(\&sort_it,$_));
          }


          $_->join for(@threads);
          my_print("Sorting completed, merging started\n");

          #$thrs = scalar(@threads);
          #print "no of threads : $thrs\n";

          #sleep(10);

          my @keys = keys %bounds;
          #my @vals = values %bounds;

          my $n_keys = scalar(@keys);
          my_print("no of keys : $n_keys\n");
          #print "vals : @vals\n";

          merge_it(\%bounds);
          my_print("merge completed\n");
          my $tm2 = &my_time();
          print "\n\n----------------Report ------------\n";
          print "---------------- Sort Start : $tm1\n";
          print "---------------- Sort End : $tm2\n";
          print "-----------------------------------\n";


          sub sort_it{

          # my $ref = shift;
          # my $tmp = shift;

          my $chunk = shift;
          my $first = 1;
          my $tid = threads->self->tid();
          my_print("thread $tid Sorting chunk : $chunk\n");
          my @buf = ();
          open(TMP,"$chunk") || die $!;
          push (@buf, $_) while(<TMP>);
          close(TMP);
          open(TMP,">$chunk") || die $!;
          for(sort {my $fields1 = substr($a,10,10);
          my $fields2 = substr($b,10,10);
          $fields1 <=> $fields2 } @buf){
          if($first){
          { #lock
          lock(%bounds);
          $bounds{$chunk} = substr($_,10,10);
          } # unlock
          $first = 0;
          }
          print TMP $_;
          }
          close(TMP);
          # my @keys = keys %bounds;
          # print "keys : @keys\n";
          my_print("thread $tid Sorting chunk : $chunk
          COMPLETED\n");

          }


          sub merge_it{
          my $ref = shift;
          my @files = sort {$ref->{$a} <=> $ref->{$b}}
          keys %{$ref};
          my $merged_to = $files[0];
          my_print("merging : $files[0]\n");
          for(my $i=1; $i<@files; $i++){
          open(FIRST,$merged_to) || dir $!;
          open(SECOND,$files[$i]) || dir $!;
          my_print ("merging : $files[$i]\n");
          my $merged_tmp = "merged_tmp$i.txt";
          open(MERGED,">$merged_tmp") || die $!;
          my $line1 = <FIRST>;
          my $line2 = <SECOND>;
          while(1){
          if(!defined($line1) &&
          defined($line2)){
          print MERGED $line2;
          print MERGED
          while(<SECOND>);
          last;
          }
          if(!defined($line2) &&
          defined($line1)){
          print MERGED $line1;
          print MERGED
          while(<FIRST>);
          last;
          }
          last if(!defined($line1) &&
          !defined($line2));
          my $value1 =
          substr($line1,10,10);
          my $value2 =
          substr($line2,10,10);
          if($value1 == $value2){
          print MERGED $line1;
          print MERGED $line2;
          $line1 = <FIRST>;
          $line2 = <SECOND>;
          }elsif($value1 > $value2){
          while($value1 >
          $value2){
          print MERGED
          $line2;
          $line2 =
          <SECOND>;
          last
          unless(defined $line2);
          $value2 =
          substr($line2,10,10);
          }
          }else{
          while($value1 <
          $value2){
          print MERGED
          $line1;
          $line1 =
          <FIRST>;
          last
          unless(defined $line1);
          $value1 =
          substr($line1,10,10);
          }
          }
          }
          close(FIRST);
          close(SECOND);
          close(MERGED);
          unlink $merged_to;
          unlink $files[$i];

          $merged_to = $merged_tmp;

          }

          }

          sub my_print
          {
          my $cur_time = my_time();
          print "$cur_time @_ ";

          }

          sub my_time()
          {
          my $time= time ;
          my $daytime = localtime($time) ;
          return $daytime ;
          }

          +++++++++++++++++++++++


          __________________________________________________
          Do you Yahoo!?
          Yahoo! Tax Center - forms, calculators, tips, more
          http://taxes.yahoo.com/
        • Madhu Reddy
          Hi, I want to find out how to pass perl variables between files and functions... in C, we declare with extern to work in different files.... how to do in
          Message 4 of 25 , Mar 3, 2003
          • 0 Attachment
            Hi,
            I want to find out how to pass perl variables
            between files and functions...
            in C, we declare with "extern" to work in different
            files.... how to do in perl...
            between files means , i declare variable in file1 and
            file2 will update those variables and want to access
            in file1
            Ex: like $var1 and $var2 in following example

            between functions means, from main file i need to pass
            variables to function..
            that function will update those arguements
            like $var3 and var4 in following example

            like in C, we pass the address of variable to
            functions

            following is the scenerio...

            File1 : Script1.pl
            ---------------------
            #!C:\perl\bin\perl -w
            require "script2.pl";

            $var1 = 0;
            $var2 = 0;

            # this is a function from another file, this function
            #needs to update $var1 and $var2
            my $ret = VAL::Validate();

            print "var1 is $var1\n";
            print "var2 is $var2\n";


            VAL::func1($var3, $var4);

            print "var3 is $var3\n";
            print "var4 is $var4\n";

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

            File : Script2.pl
            ------------------
            #!C:\perl\bin\perl -w

            package VAL;
            # here some code will be there
            sub Validate () {
            #update var1 and var2 variables

            $var1 = 50;
            $var2 = 40;
            return 0;
            }

            sub func1 {
            $var3 = shift;
            $var4 = shift;

            $var3 = 90;
            $var4 = 70;

            }
            1;

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

            Thanx
            -Madhu


            __________________________________________________
            Do you Yahoo!?
            Yahoo! Tax Center - forms, calculators, tips, more
            http://taxes.yahoo.com/
          • Charles K. Clarkson
            ... You could use symbolic references and the caller function: #!/usr/bin/perl use vars qw|$var1 $var2|; use strict; use warnings; require VAL.pl ; $var1 = 0;
            Message 5 of 25 , Mar 3, 2003
            • 0 Attachment
              Madhu Reddy <saitech74@...> wrote:

              : I want to find out how to pass perl variables
              : between files and functions...
              : in C, we declare with "extern" to work in different
              : files.... how to do in perl... between files means,

              You could use symbolic references and the caller
              function:

              #!/usr/bin/perl

              use vars qw|$var1 $var2|;

              use strict;
              use warnings;

              require "VAL.pl";

              $var1 = 0;
              $var2 = 0;

              my $ret = VAL::Validate();

              print "var1 is $var1\n";
              print "var2 is $var2\n";

              -----------------
              VAL.pl:

              package VAL;

              use strict;

              sub Validate () {
              my($caller) = caller;

              no strict 'refs';
              ${ $caller . '::var1' } = 50;
              ${ $caller . '::var2' } = 40;

              return 0;
              }

              1;

              The disadvantage is being unable to easily
              change variable names in your program. With
              this rigidity, it might be easier to place the
              variables in the VAL package and refer to them
              with the '$VAL::' prefix.

              HTH,

              Charles K. Clarkson
              --
              Head Bottle Washer,
              Clarkson Energy Homes, Inc.
              Mobile Home Specialists
              254 968-8328
            • prakash
              i have a bunch of variable (some 10) on all of them i want to replace with empty string.. as you know it confuses MYSQL.. is it possible to do it in single
              Message 6 of 25 , Mar 5, 2003
              • 0 Attachment
                i have a bunch of variable

                (some 10)

                on all of them i want to replace ' with empty string..

                as you know it confuses MYSQL..

                is it possible to do it in single command.. thank you very much for the help
                (to those who answers :-) ).

                -prak
              • prakash
                help meeeeeeee i have something like this print MAIL
                Message 7 of 25 , Mar 14, 2003
                • 0 Attachment
                  help meeeeeeee
                  i have something like this

                  print MAIL <<EOF;
                  blah blah blah

                  lkjasdf
                  lkasjdf
                  lkjasdf
                  lkajsdf

                  lkjasdfkasdkfjasdf
                  EOF


                  i want something like this instead

                  $variable = " blah blah blah

                  lkjasdf
                  lkasjdf
                  lkjasdf
                  lkajsdf

                  lkjasdfkasdkfjasdf";

                  print MAIL <<EOF;
                  $variable
                  EOF

                  my problem is how to assign that value easily since i have quotes and
                  variables inside that..

                  -prak
                • prakash
                  the solution to this is qq/blah blah/ -prak ... http://help.yahoo.com/help/us/groups/groups-32.html Your use of Yahoo! Groups is subject to
                  Message 8 of 25 , Mar 14, 2003
                  • 0 Attachment
                    the solution to this is qq/blah blah/

                    -prak


                    > -----Original Message-----
                    > From: prakash [mailto:prakash@...]
                    > Sent: Friday, March 14, 2003 3:47 PM
                    > To: perl-beginner@yahoogroups.com
                    > Subject: [PBML] variable string...
                    >
                    >
                    > help meeeeeeee
                    > i have something like this
                    >
                    > print MAIL <<EOF;
                    > blah blah blah
                    >
                    > lkjasdf
                    > lkasjdf
                    > lkjasdf
                    > lkajsdf
                    >
                    > lkjasdfkasdkfjasdf
                    > EOF
                    >
                    >
                    > i want something like this instead
                    >
                    > $variable = " blah blah blah
                    >
                    > lkjasdf
                    > lkasjdf
                    > lkjasdf
                    > lkajsdf
                    >
                    > lkjasdfkasdkfjasdf";
                    >
                    > print MAIL <<EOF;
                    > $variable
                    > EOF
                    >
                    > my problem is how to assign that value easily since i have quotes and
                    > variables inside that..
                    >
                    > -prak
                    >
                    >
                    >
                    >
                    >
                    >
                    > Unsubscribing info is here:
                    http://help.yahoo.com/help/us/groups/groups-32.html

                    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


                    ______________________________________________________
                    This email was pre-scanned by Spam Guardian
                    A Service Provided by www.foothill.net and FNFmail.com
                  • Hans Ginzel
                    ... Use the same as above: $variable =
                    Message 9 of 25 , Mar 16, 2003
                    • 0 Attachment
                      On Fri, Mar 14, 2003 at 03:46:47PM -0800, prakash wrote:
                      > i have something like this
                      >
                      > print MAIL <<EOF;
                      > blah blah blah
                      > lkjasdf
                      > EOF
                      >
                      > i want something like this instead
                      >
                      > $variable = " blah blah blah
                      > lkjasdfkasdkfjasdf";

                      Use the same as above:

                      $variable = <<EOF;
                      blah blah
                      lkjasdfkasdkfjasdf
                      EOF

                      > print MAIL <<EOF;
                      > $variable
                      > EOF

                      print $variable;

                      Regards
                      Hans G.
                    • OKAIE Yutaka
                      Instead of `print MAIL Subject: [PBML] variable string...
                      Message 10 of 25 , Apr 4, 2003
                      • 0 Attachment
                        Instead of `print MAIL <<EOF' you can use `print MAIL <<"EOF"'.

                        Thanks
                        OKAIE Yutaka

                        From: "prakash" <prakash@...>
                        Subject: [PBML] variable string...
                        Date: Fri, 14 Mar 2003 15:46:47 -0800

                        > help meeeeeeee
                        > i have something like this
                        >
                        > print MAIL <<EOF;
                        > blah blah blah
                        >
                        > lkjasdf
                        > lkasjdf
                        > lkjasdf
                        > lkajsdf
                        >
                        > lkjasdfkasdkfjasdf
                        > EOF
                        >
                        >
                        > i want something like this instead
                        >
                        > $variable = " blah blah blah
                        >
                        > lkjasdf
                        > lkasjdf
                        > lkjasdf
                        > lkajsdf
                        >
                        > lkjasdfkasdkfjasdf";
                        >
                        > print MAIL <<EOF;
                        > $variable
                        > EOF
                        >
                        > my problem is how to assign that value easily since i have quotes and
                        > variables inside that..
                        >
                        > -prak
                      • Pavlos Parissis
                        Hello all I have a file with: /home +trrr /.ssh +tr /home/.ssh +rt /home/ssh.conf +rrrr /home/conf.conf +rrrr Is the following the best way to match lines and
                        Message 11 of 25 , Dec 31, 2003
                        • 0 Attachment
                          Hello all
                          I have a file with:
                          /home +trrr
                          /.ssh +tr
                          /home/.ssh +rt
                          /home/ssh.conf +rrrr
                          /home/conf.conf +rrrr
                          Is the following the best way to match lines and store it?
                          $line =~ m/^(\/[\/a-zA-Z0-9_.]+)\s+\+(\w+)$/
                          Am I going to miss anything?


                          Happy new Year to all

                          Pavlos

                          --
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          I love having the feeling of being in control
                          while i have the sensation of speed

                          The surfer of life
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          GnuPG Key: FB1E6AE7
                          Fingerprint A9AE EA0C EE1F FBD0 5B6F 3F77 2782 EFE2 FB1E 6AE7
                          Get my key here: http://users.hol.gr/~p_pavlos/pubpgpkey.txt
                        • Brad Lhotsky
                          Why won t this work: my ($directory,$flags) = split / s+/, $line; Neither one supports spaces in file names, you d use this: my ($directory,$flags) = ($line =~
                          Message 12 of 25 , Dec 31, 2003
                          • 0 Attachment
                            Why won't this work:

                            my ($directory,$flags) = split /\s+/, $line;

                            Neither one supports spaces in file names, you'd use this:

                            my ($directory,$flags) = ($line =~ /(.*)\s+(\S+)$/);

                            Two important things about the above regular expression.
                            1) .* is a greedy match, it matches to the end of the line and "gives
                            up" characters to satisfy the rest of the regular expression. Often
                            this is the "accidental" desired effect, pay attention to greediness.
                            2) I like to use anchors, it helps the regex and you understand what
                            exactly we're talking about. If someone replaced your greedy operator
                            with its non-greedy counterpart (.*?) to avoid using greedy operators
                            because they "heard from someone that greedy operators are bad", the
                            regex would STILL match what you intended, only much much slower.

                            Enjoy,

                            On Wed, Dec 31, 2003 at 10:19:29PM +0200, Pavlos Parissis wrote:
                            > Hello all
                            > I have a file with:
                            > /home +trrr
                            > /.ssh +tr
                            > /home/.ssh +rt
                            > /home/ssh.conf +rrrr
                            > /home/conf.conf +rrrr
                            > Is the following the best way to match lines and store it?
                            > $line =~ m/^(\/[\/a-zA-Z0-9_.]+)\s+\+(\w+)$/
                            > Am I going to miss anything?
                            >
                            >
                            > Happy new Year to all
                            >
                            > Pavlos
                            >
                            > --
                            > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            > I love having the feeling of being in control
                            > while i have the sensation of speed
                            >
                            > The surfer of life
                            > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            > GnuPG Key: FB1E6AE7
                            > Fingerprint A9AE EA0C EE1F FBD0 5B6F 3F77 2782 EFE2 FB1E 6AE7
                            > Get my key here: http://users.hol.gr/~p_pavlos/pubpgpkey.txt
                            >
                            > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
                            >
                            > Yahoo! Groups Links
                            >
                            > To visit your group on the web, go to:
                            > http://groups.yahoo.com/group/perl-beginner/
                            >
                            > To unsubscribe from this group, send an email to:
                            > perl-beginner-unsubscribe@yahoogroups.com
                            >
                            > Your use of Yahoo! Groups is subject to:
                            > http://docs.yahoo.com/info/terms/
                            >
                            >

                            --
                            Brad Lhotsky <brad@...>
                          • chcst53
                            ... [snipped] ... Hello Pavlos Instead of trying to match with a regular expression, you might want to use split to get the 2 fields in your data. Cheers,
                            Message 13 of 25 , Dec 31, 2003
                            • 0 Attachment
                              --- In perl-beginner@yahoogroups.com, Pavlos Parissis
                              <p_pavlos@f...> wrote:
                              > Hello all
                              > I have a file with:
                              [snipped]
                              > Am I going to miss anything?

                              Hello Pavlos

                              Instead of trying to match with a regular expression, you might want
                              to use split to get the 2 fields in your data.

                              Cheers,
                              Chris

                              #!/usr/bin/perl
                              use strict;
                              use warnings;

                              while (<DATA>) {
                              chomp;
                              my ($v1, $v2) = split / \+/;
                              print "val1=$v1 val2=$v2\n";
                              }

                              __DATA__
                              /home +trrr
                              /.ssh +tr
                              /home/.ssh +rt
                              /home/ssh.conf +rrrr
                              /home/conf.conf +rrrr

                              ## Output ##
                              C:\perlp>perl try.pl
                              val1=/home val2=trrr
                              val1=/.ssh val2=tr
                              val1=/home/.ssh val2=rt
                              val1=/home/ssh.conf val2=rrrr
                              val1=/home/conf.conf val2=rrrr
                            • Pavlos Parissis
                              Hi, This is very nice idea but I want to find a regex to match the directories of files because in the same files I will have lines begging with ! and the dirs
                              Message 14 of 25 , Jan 1, 2004
                              • 0 Attachment
                                Hi,
                                This is very nice idea but I want to find a regex to match the directories of
                                files because
                                in the same files I will have lines begging with ! and the dirs or files and maybe
                                something else.

                                For instance:
                                !/foo/.foo
                                /foo
                                =/one/two

                                So, I want to find a very good regex to match the dirs or file.
                                So for it seems to work but I would like to hear more ideas.

                                THanks a lot for the tip
                                PAvlos

                                On Wed, 31 Dec 2003 21:38:48 -0000 "chcst53" <charley@...> wrote:
                                > --- In perl-beginner@yahoogroups.com, Pavlos Parissis
                                > <p_pavlos@f...> wrote:
                                > > Hello all
                                > > I have a file with:
                                > [snipped]
                                > > Am I going to miss anything?
                                >
                                > Hello Pavlos
                                >
                                > Instead of trying to match with a regular expression, you might want
                                > to use split to get the 2 fields in your data.
                                >
                                > Cheers,
                                > Chris
                                >
                                > #!/usr/bin/perl
                                > use strict;
                                > use warnings;
                                >
                                > while (<DATA>) {
                                > chomp;
                                > my ($v1, $v2) = split / \+/;
                                > print "val1=$v1 val2=$v2\n";
                                > }
                                >
                                > __DATA__
                                > /home +trrr
                                > /.ssh +tr
                                > /home/.ssh +rt
                                > /home/ssh.conf +rrrr
                                > /home/conf.conf +rrrr
                                >
                                > ## Output ##
                                > C:\perlp>perl try.pl
                                > val1=/home val2=trrr
                                > val1=/.ssh val2=tr
                                > val1=/home/.ssh val2=rt
                                > val1=/home/ssh.conf val2=rrrr
                                > val1=/home/conf.conf val2=rrrr
                                >
                                >
                                >
                                > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
                                >
                                >
                                > Yahoo! Groups Links
                                >
                                > To visit your group on the web, go to:
                                > http://groups.yahoo.com/group/perl-beginner/
                                >
                                > To unsubscribe from this group, send an email to:
                                > perl-beginner-unsubscribe@yahoogroups.com
                                >
                                > Your use of Yahoo! Groups is subject to:
                                > http://docs.yahoo.com/info/terms/
                                >
                                >


                                --
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                I love having the feeling of being in control
                                while i have the sensation of speed

                                The surfer of life
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                GnuPG Key: FB1E6AE7
                                Fingerprint A9AE EA0C EE1F FBD0 5B6F 3F77 2782 EFE2 FB1E 6AE7
                                Get my key here: http://users.hol.gr/~p_pavlos/pubpgpkey.txt
                              • Pavlos Parissis
                                ... (.*?) what exactly will this match? ... -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I love having the feeling of being in control while i have the sensation of speed
                                Message 15 of 25 , Jan 1, 2004
                                • 0 Attachment
                                  On Wed, 31 Dec 2003 16:37:16 -0500 Brad Lhotsky <brad@...> wrote:
                                  > Why won't this work:
                                  >
                                  > my ($directory,$flags) = split /\s+/, $line;
                                  >
                                  > Neither one supports spaces in file names, you'd use this:
                                  >
                                  > my ($directory,$flags) = ($line =~ /(.*)\s+(\S+)$/);
                                  >
                                  > Two important things about the above regular expression.
                                  > 1) .* is a greedy match, it matches to the end of the line and "gives
                                  > up" characters to satisfy the rest of the regular expression. Often
                                  > this is the "accidental" desired effect, pay attention to greediness.
                                  > 2) I like to use anchors, it helps the regex and you understand what
                                  > exactly we're talking about. If someone replaced your greedy operator
                                  > with its non-greedy counterpart (.*?) to avoid using greedy operators
                                  > because they "heard from someone that greedy operators are bad", the
                                  > regex would STILL match what you intended, only much much slower.

                                  (.*?) what exactly will this match?

                                  > Enjoy,
                                  >
                                  > On Wed, Dec 31, 2003 at 10:19:29PM +0200, Pavlos Parissis wrote:
                                  > > Hello all
                                  > > I have a file with:
                                  > > /home +trrr
                                  > > /.ssh +tr
                                  > > /home/.ssh +rt
                                  > > /home/ssh.conf +rrrr
                                  > > /home/conf.conf +rrrr
                                  > > Is the following the best way to match lines and store it?
                                  > > $line =~ m/^(\/[\/a-zA-Z0-9_.]+)\s+\+(\w+)$/
                                  > > Am I going to miss anything?
                                  > >
                                  > >
                                  > > Happy new Year to all
                                  > >
                                  > > Pavlos
                                  > >
                                  > > --
                                  > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  > > I love having the feeling of being in control
                                  > > while i have the sensation of speed
                                  > >
                                  > > The surfer of life
                                  > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  > > GnuPG Key: FB1E6AE7
                                  > > Fingerprint A9AE EA0C EE1F FBD0 5B6F 3F77 2782 EFE2 FB1E 6AE7
                                  > > Get my key here: http://users.hol.gr/~p_pavlos/pubpgpkey.txt
                                  > >
                                  > > Unsubscribing info is here:
                                  > > http://help.yahoo.com/help/us/groups/groups-32.html
                                  > >
                                  > > Yahoo! Groups Links
                                  > >
                                  > > To visit your group on the web, go to:
                                  > > http://groups.yahoo.com/group/perl-beginner/
                                  > >
                                  > > To unsubscribe from this group, send an email to:
                                  > > perl-beginner-unsubscribe@yahoogroups.com
                                  > >
                                  > > Your use of Yahoo! Groups is subject to:
                                  > > http://docs.yahoo.com/info/terms/
                                  > >
                                  > >
                                  >
                                  > --
                                  > Brad Lhotsky <brad@...>
                                  >
                                  > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
                                  >
                                  >
                                  > Yahoo! Groups Links
                                  >
                                  > To visit your group on the web, go to:
                                  > http://groups.yahoo.com/group/perl-beginner/
                                  >
                                  > To unsubscribe from this group, send an email to:
                                  > perl-beginner-unsubscribe@yahoogroups.com
                                  >
                                  > Your use of Yahoo! Groups is subject to:
                                  > http://docs.yahoo.com/info/terms/
                                  >
                                  >


                                  --
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  I love having the feeling of being in control
                                  while i have the sensation of speed

                                  The surfer of life
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  GnuPG Key: FB1E6AE7
                                  Fingerprint A9AE EA0C EE1F FBD0 5B6F 3F77 2782 EFE2 FB1E 6AE7
                                  Get my key here: http://users.hol.gr/~p_pavlos/pubpgpkey.txt
                                • Brad Lhotsky
                                  ... By itself? Nothing. In Context, whatever it HAS to match to satisfy the rest of the regular expression. It s a non-greedy (lazy) match. I wrote an intro
                                  Message 16 of 25 , Jan 1, 2004
                                  • 0 Attachment
                                    On Thu, Jan 01, 2004 at 04:54:58PM +0200, Pavlos Parissis wrote:
                                    > > 2) I like to use anchors, it helps the regex and you understand what
                                    > > exactly we're talking about. If someone replaced your greedy operator
                                    > > with its non-greedy counterpart (.*?) to avoid using greedy operators
                                    > > because they "heard from someone that greedy operators are bad", the
                                    > > regex would STILL match what you intended, only much much slower.
                                    >
                                    > (.*?) what exactly will this match?
                                    >

                                    By itself? Nothing. In Context, whatever it HAS to match to satisfy the
                                    rest of the regular expression. It's a non-greedy (lazy) match.

                                    I wrote an intro to Reg Ex for co-workers a while back:
                                    http://divisionbyzero.net/~brad/code/regex.txt

                                    This expression is covered in there ;)

                                    Enjoy,

                                    --
                                    Brad Lhotsky <brad@...>
                                  • Pavlos Parissis
                                    Hello all, I think I found an nice solution. so let me remind you the story a file with the following /mnt Myrule /koko/ 2rule dd/dd ff /etc/passwd tete
                                    Message 17 of 25 , Jan 2, 2004
                                    • 0 Attachment
                                      Hello all,

                                      I think I found an nice solution.
                                      so let me remind you the story
                                      a file with the following
                                      /mnt Myrule
                                      /koko/ 2rule
                                      dd/dd ff
                                      /etc/passwd tete
                                      /goo/goo r+t
                                      !/var/log/messages.*
                                      /mnt/extra/system_backup/etc t+t+t
                                      !/mnt/extra/system_backup/etc/reoback
                                      =/tmp g+gg
                                      =/foo r+r
                                      =ho/ddd t+t
                                      =/bar My
                                      =/slice my

                                      it looks like the side.conf file
                                      and I want to grab only the line that start with full path of "dir or files" and
                                      word+word or a word only with the capital first letter.
                                      Valid lines are all the lines that start with ! or = or /
                                      and for each of the abover correct lines the path must be the full path. The
                                      problem
                                      here is that I can not find a regex to math only valid filesystem paths.
                                      Now if the the path is like this /foo\ff it will be matched:(
                                      Any ideas about this?
                                      The code is this

                                      18 open(CONF,"<$conf");
                                      19 while (defined($line = <CONF>)) {
                                      20 my $path;
                                      21 my $flags;
                                      22 chomp($line);
                                      23 next if ($line =~ /^#.*/); # no comments.
                                      24 next if ($line =~ /^\s+/); # no leading white.
                                      25 next if ($line =~ /^\s+$/); # no trailing white.
                                      26 next unless length $line; # null and empty lines.
                                      27 ($path,$flags) = split /\s+/, $line;
                                      28 if ( !( $path =~ m/^(!|\/|=)/) ){
                                      29 print "wrong format $path\n";
                                      30 next;
                                      31 }
                                      32 if ( defined($flags) and $flags =~ /\S/ ) { # accept only flags with
                                      this w+w+w or this First.
                                      33 next if ( (!($flags =~ /^(\w\+)+\w$/)) and (!($flags =~
                                      /^[A-Z]\w+/)) );
                                      34 }
                                      35 if ($path =~ m/^(!)(\/.*)/) {
                                      36 push @excluded_dirs, $2;
                                      37 next;
                                      38 } elsif ($path =~ m/^(=)(\/.*)$/) {
                                      39 $dirs_only{"$2"} = "$flags";
                                      40 next;
                                      41 } elsif ( $path =~ m/^(\/.*)$/ ) {
                                      42 $dirs_check{"$1"} = "$flags";
                                      43 next;
                                      44 } else { print "unmatched $path\n";}
                                      45
                                      46 }
                                      47 close CONF;

                                      and gives me
                                      wrong format dd/dd
                                      unmatched =ho/ddd
                                      #####exlcuded
                                      /var/log/messages.*
                                      /mnt/extra/system_backup/etc/reoback
                                      #####match only
                                      /bar My
                                      /foo r+r
                                      #####search only
                                      /mnt/extra/system_backup/etc t+t+t
                                      /mnt Myrule
                                      /goo/goo r+t

                                      Pavlos


                                      --
                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      I love having the feeling of being in control
                                      while i have the sensation of speed

                                      The surfer of life
                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      GnuPG Key: FB1E6AE7
                                      Fingerprint A9AE EA0C EE1F FBD0 5B6F 3F77 2782 EFE2 FB1E 6AE7
                                      Get my key here: http://users.hol.gr/~p_pavlos/pubpgpkey.txt
                                    • satish
                                      Dear Sir, Can anyone suggest me how to write pattern matching for ph*.jpg, displaying all the jpg files starting from ph. Thanks and regards, Satish KM
                                      Message 18 of 25 , Dec 7, 2005
                                      • 0 Attachment
                                        Dear Sir,

                                        Can anyone suggest me how to write pattern matching
                                        for ph*.jpg, displaying all the jpg files starting
                                        from ph.

                                        Thanks and regards,
                                        Satish KM



                                        __________________________________________________
                                        Do You Yahoo!?
                                        Tired of spam? Yahoo! Mail has the best spam protection around
                                        http://mail.yahoo.com
                                      • Prakash Kumar
                                        /^ph.* .jpg$/i -Prak
                                        Message 19 of 25 , Dec 7, 2005
                                        • 0 Attachment
                                          /^ph.*\.jpg$/i

                                          -Prak


                                          On Wed, 7 Dec 2005, satish wrote:

                                          >
                                          >
                                          >
                                          > Dear Sir,
                                          >
                                          > Can anyone suggest me how to write pattern matching
                                          > for ph*.jpg, displaying all the jpg files starting
                                          > from ph.
                                          >
                                          > Thanks and regards,
                                          > Satish KM
                                          >
                                          >
                                          >
                                          > __________________________________________________
                                          > Do You Yahoo!?
                                          > Tired of spam? Yahoo! Mail has the best spam protection around
                                          > http://mail.yahoo.com
                                          >
                                          >
                                          >
                                          > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
                                          > Yahoo! Groups Links
                                          >
                                          >
                                          >
                                          >
                                          >
                                          >
                                          >
                                        • srinivas reddy
                                          I think this would work: /^ph.* .jpg$/ Thanks, Srinivas. ... -- Best Regards, Srinivas Reddy...... [Non-text portions of this message have been removed]
                                          Message 20 of 25 , Dec 7, 2005
                                          • 0 Attachment
                                            I think this would work:

                                            /^ph.*\.jpg$/


                                            Thanks,
                                            Srinivas.

                                            On 12/8/05, satish <satyakm79@...> wrote:
                                            >
                                            >
                                            >
                                            >
                                            > Dear Sir,
                                            >
                                            > Can anyone suggest me how to write pattern matching
                                            > for ph*.jpg, displaying all the jpg files starting
                                            > from ph.
                                            >
                                            > Thanks and regards,
                                            > Satish KM
                                            >
                                            >
                                            >
                                            > __________________________________________________
                                            > Do You Yahoo!?
                                            > Tired of spam? Yahoo! Mail has the best spam protection around
                                            > http://mail.yahoo.com
                                            >
                                            >
                                            >
                                            > Unsubscribing info is here:
                                            > http://help.yahoo.com/help/us/groups/groups-32.html
                                            > Yahoo! Groups Links
                                            >
                                            >
                                            >
                                            >
                                            >
                                            >
                                            >
                                            >


                                            --
                                            Best Regards,
                                            Srinivas Reddy......


                                            [Non-text portions of this message have been removed]
                                          Your message has been successfully submitted and would be delivered to recipients shortly.