AW: Different behaviour

2011-07-07 Thread HACKER Nora
Hi Rob, Thanks for your reply and your suggestions. So to make things really simple you basically make the following call: system "ps -ef |grep -v grep |grep dbw |grep -q $db"; twice the first time you get the list as expected the second time you get a -1 from the OS. Would it be possi

Different behaviour

2011-07-07 Thread HACKER Nora
Hello, I would be really glad if someone could give me a hint to my following problem: I have a script that runs smoothly on AIX5.3, installed Perl is 5.8.8. Now I need it to run on AIX6.1, Perl is 5.8.8 as well, but I experience a strange, differing behaviour. I have a sub-function that greps

Garbled lines

2011-03-24 Thread HACKER Nora
Hello, I am not sure whether this is really a Perl problem but maybe anybody can point me into the right direction: I am generating insert statements and writing them into a file for later execution. Most of the lines are written correctly: insert into serverauslastung (durchfuehrung, umgebungsna

AW: Dereferencing problem

2011-02-23 Thread HACKER Nora
erl.org > Cc: HACKER Nora > Betreff: Re: Dereferencing problem > > Hi Nora > > On 23/02/2011 12:53, HACKER Nora wrote: > > Hi, > > > > I want to work with data from my database. The following select and > > dereferencing for display is fine: > &g

Dereferencing problem

2011-02-23 Thread HACKER Nora
Hi, I want to work with data from my database. The following select and dereferencing for display is fine: my $sql = "select secondname || ' ' || firstname from supp_verantw_v"; my $sth = $dbh->prepare($sql); my $personen = $dbh->selectall_arrayref($sql) or die "geht net: $!\n"; my @personen

AW: Access single element of AOH

2011-02-21 Thread HACKER Nora
Perfectly clear, thanks, works already :-) Kind regards, Nora > -Ursprüngliche Nachricht- > Von: Malesha, Sachin [mailto:sachin.male...@siemens.com] > Gesendet: Montag, 21. Februar 2011 10:16 > An: HACKER Nora; beginners@perl.org > Betreff: RE: Access single element

WG: Access single element of AOH

2011-02-21 Thread HACKER Nora
(forwarded because forgot to „reply all”) Von: HACKER Nora Gesendet: Montag, 21. Februar 2011 10:08 An: 'Parag Kalra' Betreff: AW: Access single element of AOH Hi, Thanks for your reply, but it does not work. It produces an error and returns a wrong result. oracle

AW: Access single element of AOH

2011-02-21 Thread HACKER Nora
Hi, Thanks for your reply. The argument I want to pass on is not numeric but a string - is that possible? Kind regards, Nora > -Ursprüngliche Nachricht- > Von: Malesha, Sachin [mailto:sachin.male...@siemens.com] > Gesendet: Montag, 21. Februar 2011 09:54 > An: HACK

Access single element of AOH

2011-02-21 Thread HACKER Nora
Hello, I want to get the value of a key of a Hash that is part of an Array of Hashes, whereas the correct hash to work with is being determined by the value of another key which is passed as an argument when calling the script, but haven't yet figured out how. This is my AOH: #!/usr/bin/perl use

AW: AW: Variable variable names

2010-11-03 Thread HACKER Nora
Hi Shlomi, > > In your opinion, what should the hash mentioned in your first > > paragraph contain? > > It should contain data specific to every $lang/$kurz pair (whatever $kurz is - I > don't speak German, and one should use English identifiers in one's code.). > The keys would be either $lang o

AW: Variable variable names

2010-11-02 Thread HACKER Nora
Hi Shlomi, > Instead of calling your variables $sql_$kurz and $sth_$kurz, etc. put them in > %umg hash or a different one - possibly referenced by keys of a hash > reference or slots of an object: > > {{{ > my $lang_sql = $runtime_data{$lang} = NoraSqlObject->new; > > $lang_sql->sql( > "s

Variable variable names

2010-10-28 Thread HACKER Nora
Hello, In the below code I am desperately trying to accomplish the valid use of variable variable names but still fail. I have already read many sites, tutorials, mailing list posts, all saying that this is best accomplished by using a hash. Please would you tell me if I understood that correct

AW: Problem with comparison of numbers

2010-10-28 Thread HACKER Nora
Hi Paul, Thanks for your reply. > The problem here is to do with $anz_dbf_db. > > You have correctly noted that this is an array reference. To print in out you > have used "@$anz_dbf_db", which has printed the elements of the array, > separated by spaces. This has shown you that there is one

Problem with comparison of numbers

2010-10-27 Thread HACKER Nora
Hi, Since I do not believe that my computer suddenly has lost the ability to compare numbers correctly, I suppose there must be some mistake in my following code. To cut a long story short, the below sub 1. connects to a db, 2. gets the number of datafiles used by this db, 3. ge

DBI - bind_param_inout

2010-10-25 Thread HACKER Nora
Hi list, I have a sql package which returns a value after execution. I figured out that, when calling this package from Perl, I need a bind parameter (http://search.cpan.org/~timb/DBI-1.615/DBI.pm#bind_param_inout) that this return can be saved into so that I can use it afterwards in my Perl progr

AW: Problem with foreach loop

2010-09-27 Thread HACKER Nora
Hi Shlomi, > You shouldn't modify an array (@arr1 in this case) while iterating over it using > foreach. Otherwise, the results will be unpredictable. One option to > overcome it is to do: > > [code] > my @arr1_copy = @arr1; > > while (defined (my $arr1_elem = shift(@arr1_copy))) { > # Do

AW: Problem with foreach loop

2010-09-27 Thread HACKER Nora
ember 2010 09:34 An: HACKER Nora Betreff: Re: Problem with foreach loop When $arr2 eq '2', you shift 'one' off @arr1, but you're still working with$ arr[0], which is now 'two'. When the second foreach ends, it moves onto $arr1[1], which is 'three'

WG: Problem with foreach loop

2010-09-27 Thread HACKER Nora
Sorry, c&p-accident... The proper result should be of course: oracle:/opt/data/magna/wartung/work/nora> ./test.pl Arr1: one Arr2: 1 Arr2: 2 Arr1: two Arr2: 1 Arr2: 2 Arr1: three Arr2: 1 Arr2: 2 Regards, Nora > -Ursprüngliche Nachricht----- > Von: HACKER Nora > Gese

Problem with foreach loop

2010-09-27 Thread HACKER Nora
Hello list, Could someone please explain why this test script: my @arr1 = qw(one two three); my @arr2 = qw(1 2 3); foreach my $arr1 ( @arr1 ) { print "Arr1: $arr1\n"; foreach my $arr2 ( @arr2 ) { print "Arr2: $arr2\n"; if ( $arr2 eq '2' ) {

AW: Env::Sourced - false error

2010-08-17 Thread HACKER Nora
Hi Charles, > Hm, If you can't set oraenv directly at runtime, delaying the > import will still work. > >require Env::Sourced; > > ... # determine version, etc. > >Env::Sourced->import( qw{first/file/to/include.sh /second/file/to/ > include.sh} ); Exactly. This is just what I

AW: Env::Sourced - false error

2010-08-17 Thread HACKER Nora
Hi, Sorry for the late answer, I was kept busy at work and had no time to dig in ... > IIUC, couldn't you just set oraenv directly at runtime: > > $oraenv = "$w_conf/ora$orapat.env"; # coalesce path + filename > ^ > $ENV{ oraenv } = "$w_conf/ora$orapat.env"; Charles, tha

or with multiple statements

2010-08-16 Thread HACKER Nora
Hi list, I just implemented multiple statements after 'or' but it wouldn't work unless I put the semicolon after the closing bracket. Am I right guessing that the trailing semicolon ends the statement at the beginning and is therefore invariably needed? #!/usr/bin/perl -w use strict; use warni

AW: Is this perl statement valid?

2010-08-04 Thread HACKER Nora
Hi, Additional noob question: What would be wrong with $version = '0'.$version; ? LG, Nora > -Ursprüngliche Nachricht- > Von: Shawn H Corey [mailto:shawnhco...@gmail.com] > Gesendet: Donnerstag, 05. August 2010 01:58 > An: beginners@perl.org > Betreff: Re: Is this perl sta

AW: Compare file/dir size

2010-07-28 Thread HACKER Nora
Thanks for the hint, Jeff - rsync is perfect for my purpose, works great :-) Regards, Nora > -Ursprüngliche Nachricht- > Von: Jeff Pang [mailto:pa...@arcor.de] > Gesendet: Freitag, 23. Juli 2010 09:40 > An: HACKER Nora > Cc: beginners@perl.org > Betreff: Re: Com

Env::Sourced - false error

2010-07-28 Thread HACKER Nora
Hi list, Maybe one of you has a clue why I get a false error message when using Env::Sourced. My (test-)script is as follows: #!/usr/bin/perl -w use strict; use warnings; require Env::Sourced; # "require" necessary in main programme, just not changed for testing my $w_conf = $ENV{'W_UMG_CONFIG_P

AW: Compare file/dir size

2010-07-22 Thread HACKER Nora
> Von: Rob Coops [mailto:rco...@gmail.com] > Gesendet: Dienstag, 20. Juli 2010 14:02 > An: beginners@perl.org > Betreff: Re: Compare file/dir size > > On Tue, Jul 20, 2010 at 1:51 PM, HACKER Nora > wrote: > > > Hi, > > > > My aim is to compare two directories on

Compare file/dir size

2010-07-20 Thread HACKER Nora
Hi, My aim is to compare two directories on different servers, whereas one is the FTP'ed "copy" of the other, by checking whether both directories are of exactly the same size. I tried to accomplish that with Filesys::DiskUsage, but unfortunately the two dirs are always of different size because t

WG: Multiple background processes

2010-06-25 Thread HACKER Nora
Hi, Thanks to all of you who provided me with useful hints and tips - the Parallel::ForkManager does exactly what I want, nice'n'easy :) Kind regards, Nora > -Ursprüngliche Nachricht- > Von: HACKER Nora > Gesendet: Donnerstag, 24. Juni 2010 09:15 > An: beginn

Multiple background processes

2010-06-24 Thread HACKER Nora
Hi list, I am currently having an issue with background processes. I already searched the web and found a way how to principally send a process into background, wait for the execution to finish and then go on with the main program: my $pid = fork; if ( $pid ) { wait; print "done.\n"; } e

(un)defined troubles

2010-05-26 Thread HACKER Nora
Hi, I am having troubles with a variable that should not be defined but seems to be somehow. In the following code, the variable $localdir is declared, then I am doing a find, and in case I get a result the returned path is assigned as a value to $localdir. But somehow the latter IF results to TRU

AW: Good/best practice - pre-declare variables

2010-05-21 Thread HACKER Nora
Hi Thomas, > Let's see if I understand this correctly: > > You have a global variable $mode that's deciding the mode of operation > in your sub dblog(), to quote: > > > # DBLOG sub-function > > sub dblog { > >my ( $backup, $dbvers, $sdb ) = @_; > >SWITCH: { > >( $mode eq

AW: Good/best practice - pre-declare variables

2010-05-20 Thread HACKER Nora
Hi Shlomi, Thanks for your reply. > From a cursory look at your program, it seems that you can just set up > $mode > as a global variable, and keep it at that instead of just passing it > around. > Alternatively, maybe you'd like to define a class and keep the mode > variable > there as a propert

Good/best practice - pre-declare variables

2010-05-20 Thread HACKER Nora
Hello, I have a programme for database backup / recovery / some other tasks with several modes (e.g. ackup etc.) in wich a certain function is called. In this function I do a SWITCH, depending on the mode that the main programme is started with. In one of the cases of SWITCH (e.g. ecovery) I use a

AW: AW: Hash with variable name

2010-05-12 Thread HACKER Nora
Hi, > You put an escape character '\' (no quote) to point to another hash > (what follows / symbol, to be more precise). It's known as > (hash/array/code) references. > > my %stp_dirs = ('mvb' => \%mvb_dirs, > 'pkv' => \%pkv_dirs, > 'av' =>

AW: Hash with variable name

2010-05-12 Thread HACKER Nora
Hi Thomas, > If you "use strict;" you may not use symbolic references, i.e. (mis)use > a variable's name to create a reference to it. That's why I fixed your > code > by replacing the variable names with references to the variable I > assumed you'd wish to address. > > Maybe you should take a loo

AW: Hash with variable name

2010-05-12 Thread HACKER Nora
Hi Thomas, > Try: > > my %stp_dirs = ( 'mvb' => \%mvb_dirs, > 'pkv' => \%pkv_dirs, > 'av' => \%av_dirs, > 'be' => \%be_dirs, > 'vvw' => \%vvw_dirs ); > > while ( my($sdir,$tdir) = each %{$stp_dirs{'mvb'}}

Hash with variable name

2010-05-12 Thread HACKER Nora
Hello, Following the suggestion of one of you (sorry, don't remember who's...), I am skimming through my old Perl scripts and trying to improve them. Now I have a problem with one of them, after inserting "use strict;" - would be great, if you could help me: The script is being started with a par

AW: AW: Substition string in a variable?

2010-05-07 Thread HACKER Nora
Hi Eric, > I hope I understood your problem correctly. If you want to supply a > regexp > somewhere (e.g., in a config file) and get it applied somewhere in the > program, you can do that: Have a look at the qr// operator and, if > necessary, eval. Thanks for your input. Unfortunately, I have not

AW: Directory sizes

2010-05-05 Thread HACKER Nora
Hi Thomas, > For one thing, you're using just "du" to call the binary, so we can't > be sure you're calling the same "du" in each case. So, when logged in > on the remote machine, do "which du" and use the resulting fully > qualified path in your rexec call. Check, this is ok - locally an remotel

WG: Directory sizes

2010-05-04 Thread HACKER Nora
Hi, > my ( $rc2, $backupsizetrans ) = > rexec( > $backuphost, > 'du -k ' >. "$backupdir\/$backdir2" >. ' |tail -1 |awk \'{ print $1 }\'' > ); > > to get t

Directory sizes

2010-05-04 Thread HACKER Nora
Hi list, Maybe someone can help me with this, I have two strange directory size calculating issues: I do a my ( $rc2, $backupsizetrans ) = rexec( $backuphost, 'du -k ' . "$backupdir\/$backdir2"

AW: Passing arguments @_

2010-04-30 Thread HACKER Nora
Hi Shlomi, > Because the lack of parenthesis signifies that the right-hand-side will > be > done in scalar context. As a result it is equivalent to: > > my $var1 = scalar(@_); > > Which is the length of the @_ array (which sometimes have some valid > uses if > you're checking for optional argum

Passing arguments @_

2010-04-29 Thread HACKER Nora
Hi, For calling subroutines and passing arguments on I use e.g. my ( $var1, $var2 ) = @_; If I have only one argument, this is also ok: my ( $var1) = @_; But why does my $var1 = @_; not work? In 'perldoc perlsub' I read that I only have to use parentheses when defining more than one variabl

AW: Filehandle problem

2010-04-29 Thread HACKER Nora
> Most probably you have used an undefined scalar in an expression. Would > be good if you can mention the lines along with the line no. OMG, if only you could see me banging my head against the wall ... I am opening three filehandles shortly after each other - I already corrected the code for t

Filehandle problem

2010-04-29 Thread HACKER Nora
Hi list, Thanks for suggesting PerlCritic to me - I just love it :-) Following the instructions, I am now trying to change my filehandles from a bareword style to something more ... uhm, correct ;-) I tried my $vconfig = IO::File->new("$vconfig") or LOGDIE("$fnc - $vconfig konnte nicht geles

Meta: "Nice" Perl?

2010-04-22 Thread HACKER Nora
Hi, I wonder if some of you are in the same situation like me: I am the only Perl programmer in the company, at least trying hard to get along :-), but I have nobody to ask for help. So I spend hours and hours with my book and the internet when I'm stuck. Luckily, so far I almost always accomplish

df via rexec

2010-03-17 Thread HACKER Nora
Hi list, I want to do a 'df' on a diretory on another machine via 'rexec'. I thought I could do that via the Perl module Filesys::Df, but then I realized that I can't call a function of a module directly because the rexec executes a normal shell command. I would have wanted something like this: u

use with variable

2010-03-10 Thread HACKER Nora
Hi list, I want to use the Env::Sourced module for setting some environment variables depending on the Oracle version of a certain database: ~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~~ ~ ~ #!/usr/bin/perl -w use strict; use warnings; sub fnc { m

AW: Substition string in a variable?

2010-03-07 Thread HACKER Nora
Hi list, I haven't received any response to my last mail - does really nobody have any idea for a solution to my problem (see below)? I would very much appreciate any input. Regards, Nora > > However, part of the answer is knowing the question. If this doesn't > > do the trick for you, a more

AW: Substition string in a variable?

2010-02-24 Thread HACKER Nora
Hi Erez, > suggest dynamic input from the user during runtime. While > @ARGV//<> refers to commandline arguments sent before running > the program. If you iterate over them using the idiomatic while(<>){} > loop, you'll have a better way of making sure you only run over the > values that were giv

AW: Substition string in a variable?

2010-02-24 Thread HACKER Nora
Hi Shlomi, Thanks for your reply. > Please add "use strict;" and "use warnings;" to your code. Done. Phew, there was a whole lot of warnings/errors to be fixed :-/ > Why are you using "do" instead of "use" or "require"? Because I didn't know better :) Changed it to "require" since this is s

Substition string in a variable?

2010-02-24 Thread HACKER Nora
Hi, I want to apply a certain substition to a string, whereas the whole substitution is defined in a variable in another script. Unfortunately, it doesn't work as wanted :-( Looks like this: sub.conf: $sub='s/db$//g'; script.pl: do sub.conf; print "Please enter string: "; # e.g. mydb $input=; p