Re: Turn off $ anchor greedy behavior

2009-04-17 Thread oryann9

Perl sucks...go Ruby...I did and I am much happier!

- Original Message 

From: Michael Alipio daem0n...@yahoo.com
To: Perl Beginners beginners@perl.org; John W. Krahn jwkr...@shaw.ca
Sent: Tuesday, April 14, 2009 10:06:39 AM
Subject: Re: Turn off $ anchor greedy behavior


Aha, found it.. The split returned a list and you've just sliced it. giving 
[-1] means the list will start running through the elements backwards. 


--- On Tue, 4/14/09, Michael Alipio daem0n...@yahoo.com wrote:

 From: Michael Alipio daem0n...@yahoo.com
 Subject: Re: Turn off $ anchor greedy behavior
 To: Perl Beginners beginners@perl.org, John W. Krahn jwkr...@shaw.ca
 Date: Tuesday, April 14, 2009, 10:02 PM
  
  Or use split and return the last field:
  
  $ perl -le'
  my $string = boy, pig, 123, 123:412adbd, d0g,
  lajdlf134_ lkadsf !234,\n;
  my $value = ( split /,\s+/, $string )[ -1 ];
 
 Another mind bogling example... :-)
 I thought I would do:
 
 my @value = ( split /,\s+/, $string );
 print $value[6];
 
 How could your example, have printed the last field using [
 -1 ]?
 Can I also print say, the 3rd field using this trick?
 
 
 
 
 
 
  print $value;
  '
  lajdlf134_ lkadsf !234
  
  
  
  
  
  John
  -- Those people who think they know everything are a
 great
  annoyance to those of us who do.-- Isaac
 Asimov
  
  -- To unsubscribe, e-mail:
 beginners-unsubscr...@perl.org
  For additional commands, e-mail:
 beginners-h...@perl.org
  http://learn.perl.org/
 
 
  
 
 -- 
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/


  

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


  

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: bash in perl

2009-02-07 Thread oryann9
- Original Message 
From: pouliakhina pouliakh...@gmail.com
To: beginners@perl.org
Sent: Saturday, February 7, 2009 8:59:56 AM
Subject: bash in perl

Hello,

I try to write the name of the current directory in $x:

$x = system (pwd);

But it doesn't work. It also doesn't work in all these combinations:

$x = 'system(pwd)';
$x = system(`pwd`);

Can You help me to write the result of 'pwd' in $x?

Thank You, 
Irina


##

Ur Welcome!

$ perl -le '$x = system(pwd); print $x;'
/home/Smith
0

sm...@smith-laptop ~
$ perl -le '$x = qx(pwd); print $x;'
/home/Smith




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




sysread, sysseek, sysopen

2008-07-11 Thread oryann9
Are any of these calls deprecated or not recommended?
If so, what is recommended regardless of context.

sysopen INFILE, \/dev/vpathXXX\, 0; \$i=0; sysseek(INFILE, 0, 0); 
while(sysread INFILE, \$buf, 1) {sysseek(INFILE,268435456,1); 

thank you!



  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




passing args to sub wanted

2008-05-20 Thread oryann9
Greetings, 

I posted this question on perlmonks and received some great help, specifically 
from mirod but his recent suggestion is still not working.


Problem: This code only works when I hard-code the size to
search for in the routine. I try to pass arguments using @_, but it
does not work. How do I pass $size_input so wanted sees and uses it?


Mirod's help: 

You need to pass an additional parameter to wanted. The way to do this is to 
use a closure: File::Find::find({wanted = sub { wanted( $size_input); } }, 
$fs_input ) ;. This way wanted is called by the anonymous sub, and gets passed 
$size_input.
See Why I hate File::Find and how I (hope I) fixed it for more info.



I read the why i hate two and three times and yet still cannot get it to 
work.
thank you in advance! 
http://www.perlmonks.org/?node_id=687008


use strict;
use warnings;
use File::Find;

my ( @root_files, @large_files, %mounts, @mounts, ) ;
use vars qw/*name *dir *prune/ ;
*name   = *File::Find::name ;
*dir= *File::Find::dir ;
*prune  = *File::Find::prune ;


snip
}
else {
print USING LAST ELSE\n;
my $size_input = ( int 25 * ( 1024**2 ) ) ;
$size_input =~ tr /\000//d ;
my $wanted =  make_wanted ( \wanted_1, $size_input ) ;
File::Find::find( $wanted, $fs_input ) ;
print \n;
}

sub wanted_1 {

for my $key ( sort keys %mounts ) {
if ( $fs_input eq $key ) {
@mounts =
grep {$fs_input} @{ $mounts{$key} } ; ###-- HoA --###
}
}

if ( scalar @mounts  0 ) {
die cant search...foobarbay $! ;
}
else {
my ( $size_input ) = shift @_ ;
print $size_input,\n;
my ($dev,$ino,$mode,$nlink,$uid,$gid) ;
(( $dev,$ino,$mode,$nlink,$uid,$gid ) = lstat($_) ) 
 ( $dev = 0 ) 
 !( $File::Find::prune |= ($dev != $File::Find::topdev ) ) 
 ( int(((-s _) + 1023) / 1024 )  $size_input ) 
 push ((@large_files), $name ) ;
}
}

sub make_wanted {

my $wanted = shift ;# get the real wanted function
my @args   = @_;# freeze the arguments
my $sub = sub { $wanted-( @args ); } ;  # generate the anon sub
return $sub ;   # return it
}


print \n,scalar @large_files,\n;
exit;
snip

$size_input is being printed correctly/accurately, but nothing in the array. 


  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: website

2008-05-16 Thread oryann9
On Thu, May 15, 2008 at 3:45 PM, Dr.Ruud [EMAIL PROTECTED] wrote:
 It contains a lot of bad advice too.

You have been helpful in the past so please be so kind to point out
the *bad Advice*... Just saying it's bad really helps no one on a
beginners list. The way I see it, people will read that information,
begin to code with it, then when they run into problems they come here
only to be chastised by using such examples. Why not end that loop by
good examples?

-

Horray, Horray! I agree with all stated here. I have been doing Perl for seven 
years now and still consider myself a beginner at many concepts.


  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




website

2008-05-15 Thread oryann9
Does anyone know what happened to this website: 
http://web.archive.org/web/20041123005900/http://www.raycosoft.com/rayco/support/perl_tutor.html
It says its not available.  I thought it was a great reference and explained 
the diffs between map and grep and even sort.
Does anyone have a softcopy of its data that you can send me?

thank you!



  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




undefined format error

2008-01-31 Thread oryann9
Hello List, 

I am hoping for some help with this. I did post this same question to PerlMonks.

Undefined format STDOUT called at find_hog.tdy line 173.
Line 173 is the 1st write statement, but since there are snips in there 173 is 
not the actual line in this email.
Just look for 1st write statement.

thank you.  :)


#!/usr/bin/perl


use strict ;
use warnings ;
use File::Find ;
use File::Find::Closures qw(find_by_min_size) ;
$ENV{PATH} = qq(/usr/bin:/bin) ;
delete @ENV{qw (IFS CDPATH KSH_ENV)} ;


my ( $key, $keys, $user, $grp, $gcos, $mod, $mod2, $sz, ) ;
my ( @sorted_large_files, @sorted_root_files, );

snip

sub dateme {

##-- $mod is for modification time from file(s) --##
my $mod = shift @_ ;
my ($seconds, $minutes, $hours, $day_of_month, $month,
$year,undef,undef,  undef
) = localtime( $mod ) ;

##-- $mod2 is like $mod, but does more, allows user to see mod time from 
sprintf --##
my $mod2 = sprintf(
%02d:%02d:%02d-%02d/%02d/%02d,
(   $hours, $minutes, $seconds, $month + 1,
$day_of_month, ( $year % 100 )
)
) ;
}

snip


##-- Begin Main --##
#===#

print qq(\n) ;
my $fs   = $ARGV[0] ;
my $size = ( $ARGV[1] * 1024 * 1024 ) ;
$fs   =~ tr /\000//d ;##-- Clean user input --##
$size =~ tr /\000//d ;

die qq ( \nPlease enter filesystem followed by minimum file size to search.
Usage example: find_hog /var 25 will look in /var for files = 25Mb\n\n ),
unless ( $fs and $size ) ;

my ( @root_files, @large_files, ) ;

if ( $fs eq / ) {## only if the root directory
snip
}
elsif ( $fs =~ m|^/\w+|i ) {## matches /var
find_me( $fs, $size, 0 ) ;
}
elsif ( $fs =~ m|^[/.\w+]|i ) {## matches /.ssh
find_me( $fs, $size, 0 ) ;
}

sub find_me {
my $fs   = shift @_ ;
my $size = shift @_ ;
my ( $wanted, $list ) = find_by_min_size( $size ) ;
File::Find::find( { wanted = $wanted, no_chdir = +shift }, $fs ) ;
@large_files = $list-() ;

}   ##-- End sub --##

##-- Gather meta-data --##
#=#

use constant DIVISOR= ( 1024 ) ;
use constant LINES_PER_PAGE = ( 44 ) ;

if ( @large_files ) {
my %meta ;
for my $file ( @large_files ) {
$meta{$file} = {
'uid' = ( stat( $file ) )[4],
'gid' = ( stat( $file ) )[5],
'sz'  = ( stat( $file ) )[7],
'mod' = ( stat( $file ) )[9],
} ;

}   ##-- End For --##

for $key ( keys %meta ) {
$user= qq(N/A)
unless $user = (getpwuid ( $meta{$key}-{'uid'} ) )[0]  ; ##-- uid 
name --##

$grp = qq(N/A)
unless $grp  = (getgrgid ( $meta{$key}-{'gid'} ) )[0]  ; ##-- gid 
name --##

$gcos= qq(N/A)
unless $gcos = (getpwuid ( $meta{$key}-{'uid'} ) )[6] ; ##-- gcos 
--##

$mod = qq(N/A)
unless $mod = $meta{$key}{'mod'} ;

$sz  = qq(N/A)
unless $sz   = $meta{$key}{'sz'} / DIVISOR / DIVISOR ;

my $ofh = select( STDOUT ) ;
$= = LINES_PER_PAGE ;
select( $ofh ) ;
write ;  ## THIS IS WHERE THE ERROR IS ##
$ofh = select( LOG ) ;
$=   = LINES_PER_PAGE ;
select( $ofh ) ;
write( $ofh ) ;

}   ##-- End For --##

##-- Sort values according to sz --##

@sorted_large_files =
sort { $meta{$b}-{'sz'} = $meta{$a}-{'sz'} } keys %meta;

}   ##-- End @large_files if --##

snip
##-- Begin Format Code --##
#==#

$^L = q{};
format STDOUT_TOP =
REPORT OF LARGE FILES on:
@
qx(hostname)


Page @
$%

FileName  
OwnerGroupOwner   Gecos LastModifiedDate   Size Mb
= 
===  ===  ===  ===
.

format STDOUT =
@ 
@ @@  @|  @##.##
@sorted_large_files,
   dateme($mod,$mod2)

   .
   snip
   ##-- End Format Code --##
   ##


else {
warn \nNo file(s) over $size Mb found in $fs\n ;
exit 0 ;
}

#print \n;
#print join(\n,@sorted_large_files);
#print join(\n,@sorted_root_files);

END {
close( LOG ) or warn Log '$log' failed to close $! ;
}





  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: undefined format error

2008-01-31 Thread oryann9

Please ignore the message below b/c I worked through this.

Basically my format code is not printing in a sorted order based off of 'sz' 
yet it is correctly sorted in @sorted_large_files as you can see below SORTED.

How can I tell format to print it sorted based off of 'sz'?

Here is how I am sorting 

@sorted_large_files =
sort { $meta{$b}-{'sz'} = $meta{$a}-{'sz'} } keys %meta ;





REPORT OF LARGE FILES on:
hostname x


Page 1

FileName Owner  
  GroupOwner   Gecos  LastModifiedDateSize Mb
=
===  ===  == =   ===
/var/opt/ignite/media/image.iso  root   
  sys  N/A17:01:21-09/27/06   98.84
/var/opt/ignite/media/pseudo_root/bootvol.lifroot   
  sys  N/A17:01:20-09/27/06   98.49
/var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-11-16,22:02/flist   bin
  sys  N/A01:03:24-11/17/07   33.47
/var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-10-16,23:39/flist   bin
  sys  N/A02:40:23-10/17/07   32.28
/var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-12-16,22:02/flist   bin
  sys  N/A01:03:16-12/17/07   36.58
/var/opt/ignite/clients/0x00306E3842AF/recovery/2008-01-15,05:43/flist   bin
  sys  N/A05:44:15-01/15/08   34.33
/var/opt/ignite/clients/0x00306E4B4C3A/recovery/2008-01-15,09:44/flist   bin
  sys  N/A09:46:49-01/15/08   28.84
/var/adm/sw/save/PHCO_34255/VXVM-RUN/etc/vx/static.d/build/vold.obin
  bin  N/A03:13:11-10/06/04   28.00
/var/opt/ignite/clients/0x00306E3842AF/recovery/2007-12-15,07:49/flist   bin
  sys  N/A07:50:10-12/15/07   34.30
/var/opt/ignite/clients/0x001321EAA5D2/recovery/2008-01-16,23:50/flist   bin
  sys  N/A02:50:59-01/17/08   37.92
/var/opt/ignite/clients/0x00306E4B2BA4/recovery/2008-01-16,06:16/flist   bin
  sys  N/A06:18:46-01/16/08   65.12

SORTED
/var/opt/ignite/media/image.iso
/var/opt/ignite/media/pseudo_root/bootvol.lif
/var/opt/ignite/clients/0x00306E4B2BA4/recovery/2008-01-16,06:16/flist
/var/opt/ignite/clients/0x001321EAA5D2/recovery/2008-01-16,23:50/flist
/var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-12-16,22:02/flist
/var/opt/ignite/clients/0x00306E3842AF/recovery/2008-01-15,05:43/flist
/var/opt/ignite/clients/0x00306E3842AF/recovery/2007-12-15,07:49/flist
/var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-11-16,22:02/flist
/var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-10-16,23:39/flist
/var/opt/ignite/clients/0x00306E4B4C3A/recovery/2008-01-15,09:44/flist
/var/adm/sw/save/PHCO_34255/VXVM-RUN/etc/vx/static.d/build/vold.o

- Original Message 
From: oryann9 [EMAIL PROTECTED]
To: Perl List beginners@perl.org
Sent: Thursday, January 31, 2008 4:57:10 PM
Subject: undefined format error


Hello 
List, 

I 
am 
hoping 
for 
some 
help 
with 
this. 
I 
did 
post 
this 
same 
question 
to 
PerlMonks.

Undefined 
format 
STDOUT 
called 
at 
find_hog.tdy 
line 
173.
Line 
173 
is 
the 
1st 
write 
statement, 
but 
since 
there 
are 
snips 
in 
there 
173 
is 
not 
the 
actual 
line 
in 
this 
email.
Just 
look 
for 
1st 
write 
statement.

thank 
you.  
:)


#!/usr/bin/perl


use 
strict 
;
use 
warnings 
;
use 
File::Find 
;
use 
File::Find::Closures 
qw(find_by_min_size) 
;
$ENV{PATH} 
= 
qq(/usr/bin:/bin) 
;
delete 
@ENV{qw 
(IFS 
CDPATH 
KSH_ENV)} 
;


my 
( 
$key, 
$keys, 
$user, 
$grp, 
$gcos, 
$mod, 
$mod2, 
$sz, 
) 
;
my 
( 
@sorted_large_files, 
@sorted_root_files, 
);

snip


snip
  
  
  
  
##-- 
Begin 
Format 
Code 
--##
  
  
  
  
#==#

  
  
  
  
$^L 
= 
q{};
  
  
  
  
format 
STDOUT_TOP 
=
  
  
  
  
REPORT 
OF 
LARGE 
FILES 
on:
  
  
  
  
@
  
  
  
  
qx(hostname)


  
  
  
  
Page 
@
  
  
  
  
$%

  
  
  
  
FileName  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
Owner  
  
GroupOwner  
 
Gecos  
  
  
  
  
  
  
  
  
  
 
LastModifiedDate  
 
Size 
Mb
  
  
  
  
=  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 
===  
===  
==  
  
  
  
  
  
  
  
  
  
=  
===
  
  
  
  
.

  
  
  
  
format 
STDOUT 
=
  
  
  
  
@ 
@ 
@  
  
@  
@|  
@##.##
  
  
  
  
@sorted_large_files,  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 
dateme($mod,$mod2)

  
  
  
 
.
  
  
  
 
snip

Re: find2perl

2008-01-17 Thread oryann9
-

Will anyone help me with this issue? These three lines of code work,
 but work in a way that I am not expecting. When I tell this module to set
 no_chdir to 1 it should NOT descend directories yet it does. Am I
 supposed to have a wanted routine other than whats below? Below are the 3
 lines I have tried and below that is the entire script.

thank you!

1) File::Find::find ( { wanted = $wanted, no_chdir =
 $File::Find::no_chdir }, $fs ) ;

2) File::Find::find ( { wanted = $wanted, no_chdir = +shift }, $fs )
 ;

3) File::Find::find ( { wanted = $wanted, no_chdir =
 $File::Find::no_chdir = shift}, $fs


#!/usr/bin/perl

use strict ;
use warnings ;
use File::Find ;
use File::Find::Closures qw(find_by_min_size) ;

##-- Begin Format Code --##

my ($key,$user,$grp,$mod,$sz) ;

snip

##-- End Format Code --##

sub date_me {

my $mod = shift @_ ;
my ($seconds, $minutes, $hours, $day_of_month, $month, $year,
undef, undef, undef) = localtime($mod) ;

#printf(%02d:%02d:%02d-%02d/%02d/%04d,
( $hours, $minutes, $seconds, $month+1, $day_of_month,
 $year+1900 ) ;
}

my $log = qq(/var/adm/find_hog.log) ;
my $logg ;
open ($logg, '', $log) or warn file '$logg' was not opened $! ;

START:
print qq (\nPlease enter filesystem name in the form of /fsname or /
 just for root\n) ;
print \n;
chomp (my $fs = ) ;

if ( $fs eq / ) { # only if the root directory, do not descend.
find_me ( $fs, 0 );
}
elsif ( $fs =~ m|^/\w+|i ) { ## matches /var
find_me ( $fs, 1 );
}
elsif ( $fs =~ m|^[/.\w+]|i ) {  ## matches /.ssh
find_me ( $fs, 1 );
}
else {
 warn \nFilesystem name does not match expression.\nPlease contact
 Unix on call and or try again\n
 goto START;
}

my ( @sorted_large_files, @large_files ) ;

sub find_me {
use Data::Dumper;
my $fs = shift;
#local $File::Find::prune = shift; ##-- localize prune to just this
 block --##
#my @directory = ($fs) ;
use constant MAX_SIZE = (25*1024*1024) ;
use constant DIVISOR  = (1024) ;
my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ;
File::Find::find ( { wanted = $wanted, no_chdir = +shift }, $fs )
 ;
@large_files = $list-() ;


@sorted_large_files =
sort { -s $b = -s $a }
@large_files ;

} ##-- End sub --##

snip

--



Will / Can anyone help, pretty please?








  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: find2perl

2008-01-17 Thread oryann9
- Original Message 
From: Randal L. Schwartz [EMAIL PROTECTED]
To: oryann9 [EMAIL PROTECTED]
Sent: Thursday, January 17, 2008 6:39:35 PM
Subject: Re: find2perl


The following message is a courtesy copy of an article
that has been posted to perl.beginners as well.

 oryann9 == oryann9  [EMAIL PROTECTED] writes:

oryann9 Will anyone help me with this issue? These three lines of code
 work,
oryann9 but work in a way that I am not expecting.

Then you aren't reading the docs, or listening to anyone's help here.

Not only that, you've been rude by reposting your problem in another
 forum
http://www.perlmonks.org/index.pl?node_id=662699 without disclosing
 that
you've been getting help here, but ignoring the answers.  This wastes
 the time
of people VOLUNTEERING their time in BOTH places.

Rude.

The best thing you can do at this point is to hire a programmer, who
 will
either know how to read the docs for you, or can ask us in a way that
 won't
ignore our answers.

-- 

The reason why I post here and at perlmonks is b/c both are good to learn from. 
Who say I have to disclose what I post at perlmonks??? Not everyone use both 
resources.
No one from perlmonks seems to know the answer either, likewise here.
I have read the docs and practiced, but with no success.
Sorry for asking for help, after all isn't that what this list is for?
I think you are the one being Rude, not me.







  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: find2perl

2008-01-17 Thread oryann9
 Original Message 
From: Randal L. Schwartz [EMAIL PROTECTED]
To: oryann9 [EMAIL PROTECTED]
Cc: Perl List beginners@perl.org
Sent: Thursday, January 17, 2008 7:04:40 PM
Subject: Re: find2perl

  oryann9 == oryann9  [EMAIL PROTECTED] writes:

oryann9 No one from perlmonks seems to know the answer either,  likewise here.

This is a lie.  If you don't see that it's a lie, then no amount
of answering in EITHER place will HELP you.

Hire a programmer, please.

--

I am not a liar! I am a Christian and the only little help I have received is:

If you don't want to descend into any directories, then you are likely better 
off with opendir/readdir/closedir or glob. If you don't want to descend into 
certain directories, then you set $File::Find::prune to 1 inside your wanted 
subroutine when the current directory is one you do not want to descend into.


 First, there is no 'prune' option that you can pass in to File::Find::find().  
Second, you have to set $File::Find::prune to one (not zero). Third, you have 
to set it from within your wanted subroutine when the traversal gets to a 
directory that you don't want the traversal to descend into. 
 In your case, you appear to want to have your wanted subroutine always set 
$File::Find::prune= 1; so no subdirectories are traversed into.



So after this I practiced and tried with no success.


How does anyone in the community expect people to learn or like this language 
if there are responses in this way?
I will not argue, please do not respond. thank you.


P.S. Apologizes for not knowing I was supposed to disclose to this list I use 
perlmonks, gesz.
 




  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: find2perl

2008-01-16 Thread oryann9
- Original Message 
From: oryann9 [EMAIL PROTECTED]
To: beginners@perl.org
Sent: Friday, January 11, 2008 2:32:11 PM
Subject: Re: find2perl


You're misusing it.  Set it within the wanted() routine when you're
 looking at
a directory that you don't want to descend.  It'll be cleared to 0
 before
calling wanted(), so setting it before calling find() is completely
 useless.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.

-

Will anyone help me with this issue? These three lines of code work, but work 
in a way that I am not expecting. When I tell this module to set no_chdir to 1 
it should NOT descend directories yet it does. Am I supposed to have a wanted 
routine other than whats below? Below are the 3 lines I have tried and below 
that is the entire script.

thank you!

1) File::Find::find ( { wanted = $wanted, no_chdir = $File::Find::no_chdir }, 
$fs ) ;

2) File::Find::find ( { wanted = $wanted, no_chdir = +shift }, $fs ) ;

3) File::Find::find ( { wanted = $wanted, no_chdir = $File::Find::no_chdir = 
shift}, $fs


#!/usr/bin/perl

use strict ;
use warnings ;
use File::Find ;
use File::Find::Closures qw(find_by_min_size) ;

##-- Begin Format Code --##

my ($key,$user,$grp,$mod,$sz) ;

format STDOUT_TOP =
Page @
$%

FileName   
OwnerGroupOwner   LastMo
ate   Size
=  
===  ===  ==
  =
.

format STDOUT =
@   
@ @  @
   @##.###
$key,  
$user,   $grp,date_m
, $sz
.

##-- End Format Code --##

sub date_me {

my $mod = shift @_ ;
my ($seconds, $minutes, $hours, $day_of_month, $month, $year,
undef, undef, undef) = localtime($mod) ;

#printf(%02d:%02d:%02d-%02d/%02d/%04d,
( $hours, $minutes, $seconds, $month+1, $day_of_month, $year+1900 ) ;
}

my $log = qq(/var/adm/find_hog.log) ;
my $logg ;
open ($logg, '', $log) or warn file '$logg' was not opened $! ;

START:
print qq (\nPlease enter filesystem name in the form of /fsname or / just for 
root\n) ;
print \n;
chomp (my $fs = ) ;

if ( $fs eq / ) { # only if the root directory, do not descend.
find_me ( $fs, 0 );
}
elsif ( $fs =~ m|^/\w+|i ) { ## matches /var
find_me ( $fs, 1 );
}
elsif ( $fs =~ m|^[/.\w+]|i ) {  ## matches /.ssh
find_me ( $fs, 1 );
}
else {
 warn \nFilesystem name does not match expression.\nPlease contact Unix on 
call and or try again\n
 goto START;
}

my ( @sorted_large_files, @large_files ) ;

sub find_me {
use Data::Dumper;
my $fs = shift;
#local $File::Find::prune = shift; ##-- localize prune to just this block 
--##
#my @directory = ($fs) ;
use constant MAX_SIZE = (25*1024*1024) ;
use constant DIVISOR  = (1024) ;
my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ;
File::Find::find ( { wanted = $wanted, no_chdir = +shift }, $fs ) ;
@large_files = $list-() ;


@sorted_large_files =
sort { -s $b = -s $a }
@large_files ;

} ##-- End sub --##

if (@sorted_large_files) {
my %meta ;
for my $file (@sorted_large_files) {
$meta{$file} = {
 'uid' = (stat($file))[4],
 'gid' = (stat($file))[5],
 'sz'  = (stat($file))[7],
 'mod' = (stat($file))[9],
} ;

} ## END FOR ##

for $key ( keys %meta ) {
$user = getpwuid $meta{$key}-{'uid'} ;
$grp  = getgrgid $meta{$key}-{'gid'} ;
$mod  = $meta{$key}{'mod'} ;
$sz   = $meta{$key}{'sz'} / DIVISOR / DIVISOR ;
#print \n$key = $user\t$grp\t\t ;
#date_me($mod) ;
#printf(\t%0.3f Mb\n,$sz) ;
write ;
}

} ##-- End @sorted_large_files if --##

else {
warn \nNo file(s) over twenty-five Mb found in $fs\n ;
exit 0 ;
}

END {
close ($logg) or warn Log '$logg' failed to close $! ;
}






  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: find2perl

2008-01-11 Thread oryann9
You're misusing it.  Set it within the wanted() routine when you're
 looking at
a directory that you don't want to descend.  It'll be cleared to 0
 before
calling wanted(), so setting it before calling find() is completely
 useless.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.

-

Is this what you mean on line 9? I tried and it does not seem to work,
 meaning it still descending.

1 sub find_me {
2  use Data::Dumper;
3  my $fs = shift;
4  #local $File::Find::prune = shift; ##-- localize prune
 to just this block --##
5  #my @directory = ($fs) ;
6  use constant MAX_SIZE = (25*1024*1024) ;
7  use constant DIVISOR  = (1024) ;
8  my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ;
9  File::Find::find ( { wanted = $wanted, prune =
 $File::Find::prune = shift}, $fs ) ;
10@large_files = $list-() ;
11
12@sorted_large_files =
13 sort { -s $b = -s $a }
14@large_files ;
15
16   } ##-- End sub --##






  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: find2perl

2008-01-09 Thread oryann9


oryann9 No, but good point. My intent was to determine when -prune was
 set on
oryann9 the CLI what the De-parsed code told me, 1==true, 0==false
 because
oryann9 when I run this code below prune = 0 is not working, its
 descending
oryann9 down /.

You're misusing it.  Set it within the wanted() routine when you're
 looking at
a directory that you don't want to descend.  It'll be cleared to 0
 before
calling wanted(), so setting it before calling find() is completely
 useless.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.



-

__OUTPUT__

main::(find_hog:47):if ( $fs eq / ) { # only if the root directory
  DB1 print $fs
/
  DB2 n
main::(find_hog:48):find_me ( $fs, 0 );
  DB2 n

print caller find_me
main::(find_hog:61):my ( @sorted_large_files, @large_files ) ;
  DB2
main::(find_hog:80):if (@sorted_large_files) {
  DB2 print caller find_me
invalid top directory at /opt/perl/lib/5.8.2/File/Find.pm line 568,  line 1.

  DB3 print $fs
/
  DB4 n
main::(find_hog:81):my %meta ;
  DB4 n
main::(find_hog:82):for my $file (@sorted_large_files) {
DB4 n
main::(find_hog:83):$meta{$file} = {
main::(find_hog:84): 'uid' = (stat($file))[4],
main::(find_hog:85): 'gid' = (stat($file))[5],
main::(find_hog:86): 'sz'  = (stat($file))[7],
main::(find_hog:87): 'mod' = (stat($file))[9],
  DB4 print $file
/data/data01/recovery/archives/dubhdv04/2007-11-15,11:21
  DB5

/data/... should not be appearing if prune set to false, or 0.

__CODE__

Is this what you mean on line 9? I tried and it does not seem to work, meaning 
it still descending.

1 sub find_me {
2  use Data::Dumper;
3  my $fs = shift;
4  #local $File::Find::prune = shift; ##-- localize prune to just 
this block --##
5  #my @directory = ($fs) ;
6  use constant MAX_SIZE = (25*1024*1024) ;
7  use constant DIVISOR  = (1024) ;
8  my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ;
9  File::Find::find ( { wanted = $wanted, prune = 
$File::Find::prune = shift}, $fs ) ;
10@large_files = $list-() ;
11
12@sorted_large_files =
13 sort { -s $b = -s $a }
14@large_files ;
15
16   } ##-- End sub --##





  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: split then match, regex better?

2008-01-09 Thread oryann9
Happy New Year.

I have a series of values with the following form:

TO_Chr10_final.txt

I would like to obtain the value 10, for accounting purposes:

my $chr = ( split /_/ , $value ) [ 1 ] ;
$chr =~ /chr/i ;

$chr = $' ;

This seems convoluted.  Could someone please criticize this approach or
offer a better one?
-

yes there is many ways, but I like this one.

$ perl -le 'my $str=qq(TO_Chr10_final.txt); my @arr = unpack(A2 x 
(length($str)  1), $str); print grep {/^\d+$/} @arr;'
10

Does that help?
: )





  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




find2perl

2008-01-07 Thread oryann9

In find2perl,  prune is set to 1 for true as in DO NOT desend dirs? From the 
man page -prune
Do not descend into the directory currently matched. 

Likewise for File::Find prune set to 1?



$ find2perl /dirname -size +4092k -ls -prune



thank you




  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: find2perl

2008-01-07 Thread oryann9
oryann9 $ find2perl /dirname -size +4092k -ls -prune

Since -prune is *after* the condition of -size, you're setting
prune only for VERY VERY LARGE directories.  Is that your
intent?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777  0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl  training!


No, but good point. My intent was to determine when -prune was set on the CLI 
what the De-parsed code told me, 1==true, 0==false because when I run this code 
below prune = 0 is not working, its descending down /.


use strict ;
use warnings ;
use File::Find ;
use File::Find::Closures qw(find_by_min_size) ;
snip

find_me ( $fs, 0 );

snip

sub find_me {
use Data::Dumper;
my $fs = shift;
print FS from sub\t$fs\n;
print Dumper(local $File::Find::prune = shift); ##-- localize prune to just 
this block --##
use constant MAX_SIZE = (25*1024*1024) ;
use constant DIVISOR  = (1024) ;
my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ;
File::Find::find ( { wanted = $wanted, }, $fs ) ;

@large_files = $list-() ;

@sorted_large_files =
sort { -s $b = -s $a }
@large_files ;

} ##-- End sub --##


snip


thx for the reply!





  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




file::find

2008-01-04 Thread oryann9
Perl'ers, 

In my code I call a find routine called xyz based on what the user enters which 
can be / or /\w+.
Instead of having one block of code and another block of the same code, but 
with $File::Find::prune = 1;
can't I just pass this $File::Find::prune = 1; to my single find routine based 
on their entry?

use strict;
use warnings;
use File::Find ;
use File::Find::Closures qw(find_by_min_size) ;

snip
chomp (my $fs = ) ;

if ( $fs =~ m|\x2f{1}?|g ) {  ##-- if / is matched --#
$File::Find::prune = 1;
find_me;
}
elsif ( $fs !~ m|\/\w+| ) {
find_me;   

find_me {
 my @directory = ($fs) ;
use constant MAX_SIZE = (25*1024*1024) ;
use constant DIVISOR  = (1024) ;
my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ;
File::Find::find ( { wanted = $wanted, }, @directory ) ;

snip
}
snip

thank you




  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: outlook module

2007-11-20 Thread oryann9


Why not just create a message filter or rule or whatever Outlook calls
it (or multiple ones for various criteria)?



   
I did and it I cannot get it to work.





  

Be a better pen pal. 
Text or chat with friends inside Yahoo! Mail. See how.  
http://overview.mail.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Split string into array

2007-11-18 Thread oryann9


Tom

I thought taking a string and assigning it to an array would do it 
and I was wrong.

Here is a sample line of source;

  2004-08-03  23:57 1,712,128 GdiPlus.dll and the 
recommended split gives me 13 for the number of items. I would like 
an array that has 2004-08-03, 23:57,1,712,128,GdiPlus.dll  as 
the elements of the array.

Thanks,
Andrew

At 17:40 2007-11-17, Tom Phoenix wrote:
On 11/16/07, AndrewMcHorney [EMAIL PROTECTED] wrote:

  I now got my directory listing into an array of strings. I would
 like
  to now split up the string into a an array of strings from the
  original string. For example, I might have a string of a b c d
  and  I now want a 4 element array containing a, b, c, 'd.
 
  I did the following but it did not work.
 
  @new_dir = @string_array[$index];

What's wrong with it? Was that just some Perl-like code that you typed
at random, or was there some reason to think that it would do what you
want?

  The new_dir array is the string from the string array.
 
  Where did I go wrong?

Do you want split?

   my @pieces = split / /, a b c d;

I feel that I'm guessing (badly?) at what you want. Am I close? If
you're not trying to break up a string on space, what are you trying
to do?

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training



Tom is right as usual, so not sure what you are confused about.

/etc/skel$ perl -le 'my $string=q/2004-08-03 23:57 1,712,128 GdiPlus.dll/;print 
\n$string\n;
 my @array=split /\s/, $string; print @array;'

2004-08-03 23:57 1,712,128 GdiPlus.dll

2004-08-0323:571,712,128GdiPlus.dll

/etc/skel$ perl -le 'my $string=q/2004-08-03 23:57 1,712,128 GdiPlus.dll/;print 
\n$string\n;
my @array=split /\s/, $string; print $array[2];'

2004-08-03 23:57 1,712,128 GdiPlus.dll

1,712,128



#
# The meaning of split  #
#
split / /, $foo;
and
split ' ', $foo;
are not the same thing.  
split ' ', $foo is a special case that means to split on all sequences of 
whitespace.  
It means the same thing as split /\s+/, $foo; 




  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




outlook module

2007-11-01 Thread oryann9
All, 

I am looking for some humble advice. I keep getting annoying emails using the 
mail client 'Outlook 2003 SP2.' These messages are intended for another person 
in my company with the same name as I. Not to my surprise, the email support 
group decided to give this person an email address that only differs by one 
character, I was here prior to my clone.  I want to parse these .msg, files 
look for certain keywords, if these keywords are found compose a reply email 
that contains a pre-written message template to the original sender.

What module will fit my needs?

Thank you



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: outlook module

2007-11-01 Thread oryann9
 I am looking for some humble advice. I keep getting annoying emails
 using the mail client 'Outlook 2003 SP2.' These messages are intended for
 another 

 person in my company with the same name as I. Not to my
 surprise, the email support group decided to give this person an email address
 that only differs 

 by one character, I was here prior to my clone.  I
 want to parse these .msg, files look for certain keywords, if these
 keywords are found compose a reply 

 email that contains a pre-written
 message template to the original sender.



 What module will fit my needs?



It seems to me that your network admins need to correct their faulty
procmail routing recipes. It should not be your job to deal with this.
Do the network admins have any idea how big a problem this is? Not only
for your inconvenience, but for the other person not receiving
 messages?

Jo 


##

I have informed them, however they apparently do not care. As a courtesy, I do 
forward these specific emails on, but want to automate this courtesy process.
What module(s) do you recommended?

I am using cygwin 1.5.24 and Perl 5.8.8




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: outlook module

2007-11-01 Thread oryann9


- Original Message 
From: oryann9 [EMAIL PROTECTED]
To: Perl List beginners@perl.org
Sent: Thursday, November 1, 2007 1:02:35 PM
Subject: Re: outlook module

  I am looking for some humble advice. I keep getting annoying emails
 using the mail client 'Outlook 2003 SP2.' These messages are intended  for
 another 

 person in my company with the same name as I. Not to my
 surprise, the email support group decided to give this person an email  address
 that only differs 

 by one character, I was here prior to my clone.  I
 want to parse these .msg, files look for certain keywords, if these
 keywords are found compose a reply 

 email that contains a pre-written
 message template to the original sender.



 What module will fit my needs?



It seems to me that your network admins need to correct their faulty
procmail routing recipes. It should not be your job to deal with this.
Do the network admins have any idea how big a problem this is? Not  only
for your inconvenience, but for the other person not receiving
 messages?

Jo 


##

I have informed them, however they apparently do not care. As a  courtesy, I do 
forward these specific emails on, but want to automate this  courtesy process.
What module(s) do you recommended?

I am using cygwin 1.5.24 and Perl 5.8.8

--

After some CPAN browsing it looks like Mail::Outlook Module Version:  0.13 fits 
the bill, unless someone has any trade-secrets?




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: getting nth column of a string

2007-10-28 Thread oryann9
is there a way to get the nth column of a string in perl, similar to
awk '{print $col_no}' in awk ?

###

There are multiple ways, but here are two examples:
In the first example, split is what you need to pay attention to.
In the second example,  @F is the key here. 

$ perl -le 'my $string = qq(a b c d); print $string; print +(split)[2,3], for 
$string;'
a b c d
cd

$ echo a b c d| perl -nae 'print @F[2,3]\n;'
c d





__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Net::DNS::Resolver

2007-10-24 Thread oryann9
All, 

Why is it when I turn off debug mode, I get no output?
I was expecting output similar to what nslookup shows for a simple query. My 
goal is to look up by NAME and by IP within 2 domains to determine success and 
failure.

use strict;
use warnings;
use Carp;

snip


my $res = Net::DNS::Resolver-new(
nameservers = [qw(n.com x.com)],
recurse = 0,
debug   = 1,
);

my $query = $res-query(CLIENT IP);

  if ($query) {
  foreach my $rr ($query-answer) {
  next unless $rr-type eq A; ## Skip if not a host address record ##
  print $rr-address, \n;
  }
  }
  else {
  warn query failed: , $res-errorstring, \n;
  }



thank you!




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Net::DNS::Resolver

2007-10-24 Thread oryann9


 Why is it when I turn off debug mode, I get no output?

What output do you get when you don't turn off debug?
-- 


I found what is causing this, $query is 'undef'

So was it the intent of the person who wrote this module to have this code act 
in this way?
Do you have a recommendation on how to make this more usable in terms of 
success/failure lookups for client nodes for each BIND server?

my $query = $res-query(CLIENT_IP);
use Data::Dumper;
print Dumper($query);

using Data::Dumper with debug off I get: $VAR1 = undef;

but with debug on, I seem to get an answer

__OUTPUT__

;; query(x.x.x.x)
;; setting up an AF_INET() family type UDP socket
;; send_udp(x.x.x.x)
;; answer from x.x.x.x:53 : 43 bytes
;; HEADER SECTION
;; id = 6637
;; qr = 1opcode = QUERYaa = 0tc = 0rd = 0
;; ra = 1ad = 0cd = 0rcode  = SERVFAIL
;; qdcount = 1  ancount = 0  nscount = 0  arcount = 0

;; QUESTION SECTION (1 record)
;; x.x.x.x.in-addr.arpa.   IN  PTR

;; ANSWER SECTION (0 records)

;; AUTHORITY SECTION (0 records)

;; ADDITIONAL SECTION (0 records)
RCODE: SERVFAIL; trying next nameserver
;; send_udp(x.x.x.x:53)
;; answer from x.x.x.x:53 : 474 bytes
;; HEADER SECTION
;; id = 6637
;; qr = 1opcode = QUERYaa = 0tc = 0rd = 0
;; ra = 1ad = 0cd = 0rcode  = NOERROR
;; qdcount = 1  ancount = 0  nscount = 13  arcount = 13

;; QUESTION SECTION (1 record)
;; x.x.x.x.in-addr.arpa.   IN  PTR

;; ANSWER SECTION (0 records)

;; AUTHORITY SECTION (13 records)
.   10302   IN  NS  i.root-servers.net.
.   10302   IN  NS  g.root-servers.net.
.   10302   IN  NS  k.root-servers.net.
.   10302   IN  NS  b.root-servers.net.
.   10302   IN  NS  c.root-servers.net.
.   10302   IN  NS  f.root-servers.net.
.   10302   IN  NS  e.root-servers.net.
.   10302   IN  NS  d.root-servers.net.
.   10302   IN  NS  m.root-servers.net.
.   10302   IN  NS  l.root-servers.net.
.   10302   IN  NS  j.root-servers.net.
.   10302   IN  NS  a.root-servers.net.
.   10302   IN  NS  h.root-servers.net.

;; ADDITIONAL SECTION (13 records)
i.root-servers.net. 10302   IN  A   192.36.148.17
g.root-servers.net. 10302   IN  A   192.112.36.4
k.root-servers.net. 10302   IN  A   193.0.14.129
b.root-servers.net. 10302   IN  A   192.228.79.201
c.root-servers.net. 10302   IN  A   192.33.4.12
f.root-servers.net. 10302   IN  A   192.5.5.241
e.root-servers.net. 10302   IN  A   192.203.230.10
d.root-servers.net. 10302   IN  A   128.8.10.90
m.root-servers.net. 10302   IN  A   202.12.27.33
l.root-servers.net. 10302   IN  A   198.32.64.12
j.root-servers.net. 10302   IN  A   192.58.128.30
a.root-servers.net. 10302   IN  A   198.41.0.4
h.root-servers.net. 10302   IN  A   128.63.2.53

$VAR1 = undef;





__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Net::DNS::Resolver

2007-10-24 Thread oryann9
What output do you get when you don't turn off debug?
-- 


I found what is causing this, $query is 'undef'

So was it the intent of the person who wrote this module to have this
 code act in this way?
Do you have a recommendation on how to make this more usable in terms
 of success/failure lookups for client nodes on each BIND server?

my $query = $res-query(CLIENT_IP);
use Data::Dumper;
print Dumper($query);

using Data::Dumper with debug off I get: $VAR1 = undef;

but with debug on, I seem to get an answer

__OUTPUT__

;; query(x.x.x.x)
;; setting up an AF_INET() family type UDP socket
;; send_udp(x.x.x.x)
;; answer from x.x.x.x:53 : 43 bytes
;; HEADER SECTION
;; id = 6637
;; qr = 1opcode = QUERYaa = 0tc = 0rd = 0
;; ra = 1ad = 0cd = 0rcode  = SERVFAIL
;; qdcount = 1  ancount = 0  nscount = 0  arcount = 0

;; QUESTION SECTION (1 record)
;; x.x.x.x.in-addr.arpa.   IN  PTR

;; ANSWER SECTION (0 records)

;; AUTHORITY SECTION (0 records)

;; ADDITIONAL SECTION (0 records)
RCODE: SERVFAIL; trying next nameserver
;; send_udp(x.x.x.x:53)
;; answer from x.x.x.x:53 : 474 bytes
;; HEADER SECTION
;; id = 6637
;; qr = 1opcode = QUERYaa = 0tc = 0rd = 0
;; ra = 1ad = 0cd = 0rcode  = NOERROR
;; qdcount = 1  ancount = 0  nscount = 13  arcount = 13

;; QUESTION SECTION (1 record)
;; x.x.x.x.in-addr.arpa.   IN  PTR

;; ANSWER SECTION (0 records)

;; AUTHORITY SECTION (13 records)
.   
snip

$VAR1 = undef;


A manual nslookup does work :

# nslookup
Default Server:  xxx.xxx.xxx.com
Address:  10..xx.xx.xx

 server ns7.xx.com
Default Server:  ns7.xx.com
Address:  xx.xx.xx.xx

 10.8.xx.xx## Client IP
Server:  ns7.xx.com
Address:  xx.xx.xx.xx

Name:xxx.xxx.xxx.com
Address:  10.xx.xx.254

 server xxx.xxx.xxx.com
Default Server:  xxx.xxx.xxx.com
Address:  10.220.xx.xx

 10.8.xx.xx ## Client IP
Server:  xx.xx.xx.com
Address:  10.220.13.132

Name:xxx.xxx.xxx.com
Address:  10.8.xx.xx 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: manipulating csv file fields through perl

2007-08-28 Thread oryann9


 Something like
 #!/usr/bin/perl
 use strict;
 use DBI;
 
 my $dbh =
 DBI-connect(DBI:CSV:f_dir=/dir/with/the/csvs)
 or die Cannot connect:  . $DBI::errstr;
 
 $dbh-{'csv_tables'}-{'SomeName'} = { 'file' = 
 'SomeName20070827.csv'};
 # tie the table name to the filename
 
 my $sth = $dbh-prepare('UPDATE SomeName SET Foo =
 Foo * Bar');
 $sth-execute();
 # specify an execute the action
 
 __END__

I read the CPAN module DBD::CSV and still had some
questions.

1)Does this create a in memory database with data
from the spreadsheet for manipulation?

2)This is really cool! Does anyone have a working
example of inserting, deleting and substituting data
in cells?

In the doc it states:

$dbh-do(UPDATE $table SET id = 3 WHERE id = 1);

and

$dbh-do(DELETE FROM $table WHERE id  1);

Would $table be the name of the csv file? 

thank you
:)


  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: manipulating csv file fields through perl

2007-08-28 Thread oryann9

--- Lawrence Statton [EMAIL PROTECTED] wrote:

  I read the CPAN module DBD::CSV and still had some
  questions.
  
  1)Does this create a in memory database with
 data
  from the spreadsheet for manipulation?
 
 What did reading the source tell you?
 
  
  2)This is really cool! Does anyone have a working
  example of inserting, deleting and substituting
 data
  in cells?
 
 Well, since it is a DBI driver, *any* DBI-aware
 program could use it,
 within the limitations of the subset of SQL that it
 supports.
 
  
  In the doc it states:
  
  $dbh-do(UPDATE $table SET id = 3 WHERE id = 1);
  
  and
  
  $dbh-do(DELETE FROM $table WHERE id  1);
  
  Would $table be the name of the csv file? 
  

Lawrence

Thank you for replying but since I am trying to learn
your response did not help much. :(
Any add'l help?

Anyway here is what I have tried:

#!/usr/bin/perl

use strict;
use warnings;
use DBI;

my $dbh = DBI-connect
(
 DBI:CSV:f_dir=/cygdrive/c/temp,
 DBI:CSV:csv_sep_char=\\;
)
or die Cannot connect:  . $DBI::errstr;


$dbh-{'csv_tables'}-{'data'} = { 'file' =
'UID_CHECK.csv'};
# tie the table name to the filename

my $sth = $dbh-prepare(SELECT * FROM data);
$sth-execute() or die Cannot execute:  .
$sth-errstr();
$sth-finish();
$dbh-disconnect();

IN DEBUG MODE:

DB1 n

Execution ERROR: No such column 'PL.1,'.

 at /usr/lib/perl5/site_perl/5.8/SQL/Statement.pm line
2052
   
SQL::Statement::do_err('DBD::CSV::Statement=HASH(0x1093cc54)',
'No such column \'PL.1,\'') call
ed at /usr/lib/perl5/site_perl/5.8/SQL/Statement.pm
line 1665
   
SQL::Statement::verify_columns('DBD::CSV::Statement=HASH(0x1093cc54)',
'DBI::st=HASH(0x10953cf0
)', 'SQL::Eval=HASH(0x1096386c)', 'ARRAY(0x10852618)')
called at /usr/lib/perl5/site_perl/5.8/SQL/State
ment.pm line 778
   
SQL::Statement::SELECT('DBD::CSV::Statement=HASH(0x1093cc54)',
'DBI::st=HASH(0x10953cf0)', 'ARR
AY(0x10957424)') called at
/usr/lib/perl5/site_perl/5.8/SQL/Statement.pm line 196
   
SQL::Statement::execute('DBD::CSV::Statement=HASH(0x1093cc54)',
'DBI::st=HASH(0x10953cf0)', 'AR
RAY(0x10957424)') called at
/usr/lib/perl5/site_perl/5.8/cygwin/DBD/File.pm line
441
eval {...} called at
/usr/lib/perl5/site_perl/5.8/cygwin/DBD/File.pm line
441
   
DBD::File::st::execute('DBI::st=HASH(0x10953cf0)')
called at csv_manip.plx line 19
main::(csv_manip.plx:20):   $sth-finish();
  DB1



  

Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




pittsburgh perl

2007-08-20 Thread oryann9
Anyone from this list going?
How much was it last year for entry? It does not say
how much it is yet at http://pghpw.org/ppw2007/.

:)


  

Shape Yahoo! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Is it wrong...croak vs die...carp vs warn

2007-08-14 Thread oryann9

--- [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 On Aug 13, 9:33 pm, [EMAIL PROTECTED] (Oryann9)
 wrote:
 
  From the Perl Review and my understanding as well,
 use
  Carp with keywords carp and croak is supposed to
  provide additional detail in your errors and
 warnings.
 
 Perl Review eh? That's foy isn't it? I'm just
 reviewing his book
 Mastering Perl at the moment and the section on
 carp/croak seems to
 be predicated on (or, at least, likely to impart)
 similar
 misconceptions.
 

Yes I was only stating what I read, but now I know the
facts.

cheers,


  

Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Is it wrong...croak vs die...carp vs warn

2007-08-13 Thread oryann9

--- Paul Lalli [EMAIL PROTECTED] wrote:

 On Aug 13, 2:39 pm, [EMAIL PROTECTED] (Robert Hicks)
 wrote:
  I typically use Carp; and change my die and
 warn statements to
  croak and carp. I have read a couple places
 croak/carp are a little
  better at telling you what and where than the
 standard die/warn.
 
 There is no right or wrong here.  croak() and die()
 are used for two
 different purposes.  You use each one when it's
 appropriate to use
 them.
 
 In a subroutine or method, you use croak/carp if the
 error is
 something the caller of your code did wrong.  You
 use die/warn if the
 error is something unexpected in your code.  For
 example:
 
 package MyClass;
 sub new {
my $class = shift;
my $name = shift or croak Must pass name
 parameter to new()
 method!;
open my $cfg_fh, '', 'MyClass.cfg' or die
 Unable to open config
 file: $!;
chomp(my $attr = $cfg_fh);
my $ref = { name = $name, attr = $attr };
return bless $ref, $class;
 }
 
 If the user forgets to pass the name parameter to
 your class, you need
 to tell the user which call to new() it was that has
 the error.  The
 user doesn't care that it happened in line 4 of your
 module.
 
 If the configuration file cannot be opened, you want
 to know where in
 your module you attempted to open it so you can see
 if it has the
 right name or whatnot.  You don't care where in the
 calling code new()
 was called.
 
 Paul Lalli
 

From the Perl Review and my understanding as well, use
Carp with keywords carp and croak is supposed to
provide additional detail in your errors and warnings.
Also similar to stating 'use diagnostics;'


   

Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Regular Expression Problem

2007-08-10 Thread oryann9


  like to know why this isn't working. The snippet
 of code in question
  is as follows
 
  snip
  if($ARGV[2] =~ /port/i  $ARGV[3] =~ /nick/i)
  {
  snip
 
 Well, on a hunch I'd say that snippet returns false
 because either
 $ARGV[2] doesn't match /port/i, or because $ARGV[3]
 doesn't match /
 nick/i.
 
 If you want more help than that, perhaps you should
 post a short-but-
 complete script that demonstrates what you're doing.
 
 Paul Lalli

Another hunch looking at your syntax, ideally you
should be using the lesser precedence operator 'and'
instead of the higher precedence operator ''. Yes
plz show the command line string. :)

if($ARGV[2] =~ /port/i and $ARGV[3] =~ /nick/i)


  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: How do you use Perl?

2007-08-09 Thread oryann9

  Just be curious to see how do you guys use Perl
 for work.Would you be
  pleased to give a vote below?
 
  [a] CGI/Web Development
  [b] System Administration
  [c] mod_perl -- write Apache handler
  [d] write commercial products
  [e] Biological analysis
  [f] others
 

a and b I use Perl for at work as a Unix (HP, AIX,
Sun)admin.

Paul, what college?


   

Be a better Heartthrob. Get better relationship answers from someone who knows. 
Yahoo! Answers - Check it out. 
http://answers.yahoo.com/dir/?link=listsid=396545433

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Timelocal's input parameters

2007-08-08 Thread oryann9


 #!/usr/bin/perl
 use strict;
 use warnings;
 use Time::Local;
 
 my %month;
 @month{ qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct
 Nov Dec/ } = 0..11;
 
 my $date = Thu Mar  9 23:04:03 2006;
 
 my (undef, $month, $day, $h, $m, $s, $year) = split
 /\W+/, $date;
 
 my $time =
 timelocal($s,$m,$h,$day,$month{$month},$year);
 
 print $time,$/;
 
 print scalar localtime $time;
 
 
 (Prints)
 1141963443
 Thu Mar  9 23:04:03 2006

Jeff, 

Is this an array of hashes desingnated by { }?

my %month;
@month{ qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct
Nov Dec/ } = 0..11;


   

Moody friends. Drama queens. Your life? Nope! - their life, your story. Play 
Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Timelocal's input parameters

2007-08-08 Thread oryann9

-
 No, it is a hash slice.
 
 my %foo;
 @foo{ qw / one two three / } = qw / uno dos tres / ;
 
 is equivalent to 
 
 my %foo = ( one   = 'uno',
 two   = 'dos',
 three = 'tres' );
 
 is equivalent to ...
 
 my %foo;
 $foo{one}   = 'uno';
 $foo{two}   = 'dos';
 $foo{three} = 'tres';
 

ok thanks...for clearing that up!


   

Looking for a deal? Find great prices on flights and hotels with Yahoo! 
FareChase.
http://farechase.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




slices

2007-08-08 Thread oryann9
Trying to understand from perldoc perldata the diff
between these 3 CLIs and why the 2nd CLI has no
elements?

$ perl -le 'use Data::Dumper; @c = (0,1)[1]; print
Dumper([EMAIL PROTECTED]);'
$VAR1 = [
  1
];

$ perl -le 'use Data::Dumper; @c = (0,1)[2]; print
Dumper([EMAIL PROTECTED]);'
$VAR1 = [];


$ perl -le 'use Data::Dumper; @c = (0,1)[0]; print
Dumper([EMAIL PROTECTED]);'
$VAR1 = [
  0
];


   

Building a website is a piece of cake. Yahoo! Small Business gives you all the 
tools to get online.
http://smallbusiness.yahoo.com/webhosting 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: foreach broken in my script

2007-07-05 Thread oryann9

--- Randal L. Schwartz [EMAIL PROTECTED]
wrote:

  Jeff == Jeff Pang [EMAIL PROTECTED]
 writes:
 
 Jeff May you need eval?Like,
 
 No.  Wrong direction for a solution.  Don't suggest
 things like this.  Plenty
 of proper answers elsewhere in the thread, so I
 won't repeat them.
 
 DO NOT USE STRING EVAL.  EVER.
 
 Until you understand why I said that. :)

Will you kindly explain the logic/reasoning behind
this EVER rule?

thank you...



   

Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: require question

2007-07-05 Thread oryann9
 When I see code that starts with:
 
 require 5.6.0;
 
 Does that mean that the version of Perl can be 5.6.0
 and above or that 
 it *has to be* 5.6.0?

...that version and above 
see the output from;
perldoc -f require



 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: CPU/Memory usage of a process on Windows machine

2007-06-29 Thread oryann9

 #!c:/perl/bin/perl.exe
 # This is a test scrip
 use Win32::Process::Info;
 use warnings;
 use strict;
 my  $pi = Win32::Process::Info-new ();
 my @process_information  = $pi-GetProcInfo(4488);
 ## 4488 is pid of a
 particular process.
 foreach  $info (@process_information) {
   foreach my $key (keys %{$info}) {
   if ($key eq 
 WorkingSetSize) {
   my 
 $value = ${$info}{$key}/1024;
   print 
 $key:=$value \n
   }
 
   }
 }
 
 

I tried to use a regexp like so
and it prints nothing, however I use the PID of the
outlook process and it works??? 
Any help would be appreciated!

my $name qr(/out\w+/i);
my @process_information  = $pi-GetProcInfo($name);




 

Finding fabulous fares is fun.  
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel 
bargains.
http://farechase.yahoo.com/promo-generic-14795097

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: CPU/Memory usage of a process on Windows machine

2007-06-29 Thread oryann9

You have to add UserModeTime and KernelModeTime then
divide by 10,000,000.

See:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept05/hey0922.mspx

use Win32::Process::Info;
use Data::Dumper;

my $pi = Win32::Process::Info-new ();
my @process_information = $pi-GetProcInfo(3692);


foreach my $info (@process_information) {
foreach my $key (keys %{$info}) {
 if ($key eq Name or $key eq
WorkingSetSize or
$key eq UserModeTime or $key eq
KernelModeTime) {
my $value = ${$info}{$key};
   print \n$key: = $value \n;
}
}
}

~



   

Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: [PERL] Net::SFTP functions

2007-06-27 Thread oryann9

--- Octavian Rasnita [EMAIL PROTECTED] wrote:

 Hi,
 
 You need to use:
 
 $ftp-get(/path/to/remote/file,
 /path/to/local/destination_file);
 
 Octavian
 


Also you can use

$remotedir = qq(/path/to/remoteserver/dir/);
$sftp-cwd($remotedir) || die CWD to folder outbound
failed!: $!,
   
## OHMONSTER here is the remote file
 foreach ( $sftp-ls() ) {
  if (/${$fref}\d+\w+/) {
   $OHMONSTER = $_;
   $sftp-get( $OHMONSTER, $localdir/$OHMONSTER )
 || die SFTP get from .com failed!: $!,



 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food  Drink QA.
http://answers.yahoo.com/dir/?link=listsid=396545367


   

Building a website is a piece of cake. Yahoo! Small Business gives you all the 
tools to get online.
http://smallbusiness.yahoo.com/webhosting 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Uninstalling a PERL module

2007-06-22 Thread oryann9

--- a_arya2000 [EMAIL PROTECTED] wrote:

 Hello, does anyone know what is the most effective
 way
 of uninstalling perl module? Thank you.
 
Why would you want to do such a thing?  Just take the
path to this module out of @INC by editing your
.profile and or PERL5LIB variable, unless you think
its corrupt.

perl -le 'print join(\n, @INC);'

If you really want to remove this module do a backup
first, tar cvf module.tar /path/to/module, 
then rm -rf /path/to/module

Here is a script to see what is installed.

##-- Show me all installed Modules --##
use File::Find 'find';
use File::Spec::Functions;

my $i=0;
print Your installed modules on $^O are:\n;
print - x 38,\n;
find { wanted = sub { print ++$i, \t$_\n if
/\.pm\z/ },
no_chdir = 1},
@INC;
 
Hope that helps! :)


   

Be a better Globetrotter. Get better travel answers from someone who knows. 
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=listsid=396545469

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Simple Encryption - what function/module could I use?

2007-06-21 Thread oryann9
So you are using the binary ^ to encrypt with XORED
together bit by bit?  Please explain?

 thank you.
 
 
 $/etc/skel
 $ perl -le 'print hello ^ X;'
 0=447
 
 $ perl encrypt.plx file2
 plaintext:
 hello
 
 encryptedtext:
 0=447R
 
 decryptedtext:
 hello


Also noticed I could use binary  and |

$ perl -le 'print hello  X;'
[EMAIL PROTECTED]

$ perl -le 'print hello | X;'
x}||#8962;

but these were not decrypted.  Why not?



  
___
You snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_html.html

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Simple Encryption - what function/module could I use?

2007-06-21 Thread oryann9
ok must of missed it. sorry.


   

Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread oryann9

  #!/usr/bin/perl
 
  use strict;
  use warnings;
 
  my $plaintext = do { local $/ = undef;  };
  my $pad = X x length $plaintext;
 
  my $encryptedtext = $plaintext  ^ $pad;
  my $decryptedtext = $encryptedtext  ^ $pad;
  print

plaintext:\n$plaintext\n\nencryptedtext:\n$encryptedtext\n\n,
  decryptedtext:\n$decryptedtext\n;
 
 
 I like it! I just need a simple way to encypt text
 to store in a text
 file. To protect sensitive info.
 Thanks
 


I like it to, but dont understand how it is
encrypting.
Will you kindly expalin?


   

Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread oryann9

--- oryann9 [EMAIL PROTECTED] wrote:

 
   #!/usr/bin/perl
  
   use strict;
   use warnings;
  
   my $plaintext = do { local $/ = undef;  };
   my $pad = X x length $plaintext;
  
   my $encryptedtext = $plaintext  ^ $pad;
   my $decryptedtext = $encryptedtext  ^ $pad;
   print
 

plaintext:\n$plaintext\n\nencryptedtext:\n$encryptedtext\n\n,
   decryptedtext:\n$decryptedtext\n;
  
  
  I like it! I just need a simple way to encypt text
  to store in a text
  file. To protect sensitive info.
  Thanks
  

Please ignore last message and read this one.
So you are using the binary ^ to encrypt with XORED
together bit by bit?  Please explain?

thank you.


$/etc/skel
$ perl -le 'print hello ^ X;'
0=447

$ perl encrypt.plx file2
plaintext:
hello

encryptedtext:
0=447R

decryptedtext:
hello


  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread oryann9
  
#!/usr/bin/perl
   
use strict;
use warnings;
   
my $plaintext = do { local $/ = undef;  };
my $pad = X x length $plaintext;
   
my $encryptedtext = $plaintext  ^ $pad;
my $decryptedtext = $encryptedtext  ^ $pad;
print
  
 

plaintext:\n$plaintext\n\nencryptedtext:\n$encryptedtext\n\n,
decryptedtext:\n$decryptedtext\n;
   
   
   I like it! I just need a simple way to encypt
 text
   to store in a text
   file. To protect sensitive info.
   Thanks
   
 
 Please ignore last message and read this one.
 So you are using the binary ^ to encrypt with XORED
 together bit by bit?  Please explain?
 
 thank you.
 
 
 $/etc/skel
 $ perl -le 'print hello ^ X;'
 0=447
 
 $ perl encrypt.plx file2
 plaintext:
 hello
 
 encryptedtext:
 0=447R
 
 decryptedtext:
 hello


Also noticed I could use binary  and |

$ perl -le 'print hello  X;'
[EMAIL PROTECTED]

$ perl -le 'print hello | X;'
x}||#8962;

but these were not decrypted.  Why not?


   

Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Getting a program pid

2007-06-13 Thread oryann9
 
 #!/usr/bin/perl -w
 
 use strict;
 
 my $program = vi;
 my $status  = `/bin/ps cat | /bin/grep $program`;
 
 if ( length($status)  0 ) {
 print $status;   #extract
 pid from here
 }
 else { print $program not running\n }# start
 program
 
 


This will work, in the past I have used 
http://search.cpan.org/~durist/Proc-ProcessTable-0.41/Process/Process.pm

and 

http://search.cpan.org/~wyant/Win32-Process-Info-1.009/lib/Win32/Process/Info.pm


   

Get the free Yahoo! toolbar and rest assured with the added security of spyware 
protection.
http://new.toolbar.yahoo.com/toolbar/features/norton/index.php

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




flock question

2007-06-11 Thread oryann9
In this code:

BEGIN {
  use Fcntl ':flock';
  open( DATA, qq(C\:\\temp\\file.txt) )
  or die file handle was not opened: $!;
  for my $foo (DATA) {
  print $foo;
  }
  flock DATA, LOCK_EX | LOCK_NB or exit 0;  
}

Is there anything more one could add to this statement
from the Cookbook:

If you use LOCK_NB and are refused a LOCK_SH, then you
know that someone else has a LOCK_EX and is updating
the file. If you are refused a LOCK_EX, then someone
holds either a LOCK_SH or a LOCK_EX, so you shouldn't
try to update the file.

thank you





   

Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: encode UTF8 - MIME

2007-05-31 Thread oryann9
 Oddly, there's a uri_unescape_utf8 but no
 uri_unescape_utf8 provided
 by URI::Escape.
 
 However combining URI::Escape::uri_unescape() and
 Encode::decode_utf8()
 in one statement is not overly taxing.
 
 use Encode;
 use URI::Escape qw(uri_unescape);
 my $e_accute = decode_utf8 uri_unescape '%C3%A9';
 
 
Is %C3 equal to à Capital A, tilde 
and
%A9 equal to © Copyright.

?

So you are trying to convert to HTML Flash found here
http://www.allwebco-templates.com/support/S_hex.htm?


http://dsmith1.userworld.com/html_css/derek.htm



   

Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: regexp ...

2007-05-11 Thread oryann9

   Now I am trying to break up string into
 individual
   chars, but this does not seem to work:
  snip
  
  The idiomatic way is
  
  for my $chr (split //, $str) {
  }
 
 Funny I had to explain split /|/, $str returning an
 array of characters.
 
 -- 
 Ken Foskey
 FOSS developer
 

Excellent Ken,

thank you, but why the pipe | and how does this differ
from ' ' or \s+.  I used Dumper and it showed the
array of chars, but want to understand.



   
Take
 the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos  more. 
http://mobile.yahoo.com/go?refer=1GNXIC

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: regexp ...

2007-05-11 Thread oryann9

 Since you haven't provided the original data, it's a
 bit difficult to
 give advice. There's nothing here, for instance, to
 show what you hope
 to gain by splitting the string into characters. It
 looks to me like
 you have CSV and want to split on the commas:

Jay the original data I posted 3 or so emails ago, but
here it is, all on one line.
:)

'msgagt=ESM_WMB_AIX,sec_id=Sec_id,severity=Low,node=test,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26
18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCode=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An
error has been reported by the BIPXML4C
component.:XML}' '[EMAIL PROTECTED]

Code is:

#!/usr/bin/perl

use strict;
use warnings;
#use diagnostics;
use Data::Dumper;

my $ovo= qq(/home/dbsmith/out);
my (@chars,$char) = ();
my $msgagt = qr/(\w+\=\w+\,)/is;
open (my $out, +, $ovo) or die file '$ovo' was not
opened $!;

while ($out) {
s/^\s+|\s+$//g;  # rid of newlines at begin and
end
next unless length $_; ## skip line of length
undef
if (/$msgagt/) {
push @chars, $_;
}
}
## Have not coded last part to grab om{...

maybe best solution is a hash while splitting on /=/,
but I tried this and did not get it to work.

I only need out of this :

msgagt=ESM_WMB_AIX

sec_id=Sec_id

severity=Low

msgnode=qwmbap01.cardinalhealth.net

utc={2007-04-26 18:01:59.472+00:00}

om={

UID=3a7affd6-f420-11db-80b1-

AlertCode=AEM001

AlertType=AEM-default

AppName=AEM-CommonService2

Message=5004:An error has been reported by the
BIPXML4C component.:XML

}




   
Got
 a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: regexp ...

2007-05-11 Thread oryann9
'msgagt=ESM_WMB_AIX,sec_id=Sec_id,severity=Low,node=test,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26
18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCode=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An
error has been reported by the BIPXML4C
component.:XML}' 'MS_Alert_E


Take that back...meant to say all I need it everything
between '=' and ',' then everything after utc{ and
om{, but these names are not static so \w+\{ may work,
but have not tried \w+\{




   
Get
 the free Yahoo! toolbar and rest assured with the added security of spyware 
protection.
http://new.toolbar.yahoo.com/toolbar/features/norton/index.php

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




regexp

2007-05-10 Thread oryann9
I have this block of text:

Node:  dudbqa02 Message group: MoM_OpC_ADM-m-s
Application:   OGTP Object:syslog Severity:   
  Critical Text:  WebSph

ere Broker v6003[2998366]:
(QWMB01.EG500)[8225]BIP2951I: Event generated by user
code. Additional information :
'msgagt=ESM_WMB_AIX,sec_id=Sec

_id,severity=Low,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26
18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCod

e=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An
error has been reported by the BIPXML4C
component.:XML}' 'MS_Alert_E

SM_Integrator.InsertToSYSLOG' '{2}' '{3}' '{4}' '{5}'
'{6}' '{7}' '{8}' '{9}' :
QWMB01.1aef50ec-1001--0080-dae5df22a0ad:
/build/S600_P/src

/DataFlowEngine/ImbRdl/ImbRdlThrowExceptionStatements.cpp:
158: SqlThrowExceptionStatement::execute:
ComIbmComputeNode: MS_Alert_ESM_Integrato

r#FCMComposite_1_2,cma={Location=Not_found,BusUnit=Not_found}

 

The strings I need out of this are:

msgagt=ESM_WMB_AIX

sec_id=Sec_id

severity=Low

msgnode=qwmbap01.cardinalhealth.net

utc={2007-04-26 18:01:59.472+00:00}

om={

UID=3a7affd6-f420-11db-80b1-

AlertCode=AEM001

AlertType=AEM-default

AppName=AEM-CommonService2

Message=5004:An error has been reported by the
BIPXML4C component.:XML

}


I have this test code but does not work:

#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;

my $ovo= qq(/home/dbsmith/out);
my $msgagt = qr/(\w+\=\w+)/is;
open (my $out, +, $ovo) or die file '$ovo' was not
opened $!;

while ($out) {
s/^\s+|\s+$//g; ## rid of newlines at
begin and end
next unless length $_;  ## skip line of length
undef
print $_ if (/$msgagt/);
}


Any help/ideas?
thank you.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: regexp ...

2007-05-10 Thread oryann9

 
 The strings I need out of this are:
 
 msgagt=ESM_WMB_AIX
 
 sec_id=Sec_id
 
 severity=Low
 
 msgnode=qwmbap01.cardinalhealth.net
 
 utc={2007-04-26 18:01:59.472+00:00}
 
 om={
 
 UID=3a7affd6-f420-11db-80b1-
 
 AlertCode=AEM001
 
 AlertType=AEM-default
 
 AppName=AEM-CommonService2
 
 Message=5004:An error has been reported by the
 BIPXML4C component.:XML
 


Now I am trying to break up string into individual
chars, but this does not seem to work:

while ($out) {
   s/^\s+|\s+$//g; ## rid of newlines at begin and end
   next unless length $_; ## skip line of length undef
   push @chars, unpack (A* x length($_), $_);
}


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: regexp ...

2007-05-10 Thread oryann9
  Now I am trying to break up string into individual
  chars, but this does not seem to work:
 snip
 
 The idiomatic way is
 
 for my $chr (split //, $str) {
 }

ok thanks for this code, but that produces the same
output as the unpack. :)

The original code (\w+\=\w+,) seems work but is
grabbing all the garbage infront:

ere Broker v6003[2998366]:
(QWMB01.EG500)[8225]BIP2951I: Event generated by user
code. Additional information :
'msgagt=ESM_WMB_AIX,sec_id=Sec_id,severity=Low,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26
18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCode=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An
error has been reported by the BIPXML4C
[EMAIL PROTECTED] vi parse_4_ovo.plx 
2,cma={Location=Not_found,BusUnit=Not_found}



Goal is:
 
msgagt=ESM_WMB_AIX
sec_id=Sec_id
severity=Low
msgnode=qwmbap01.cardinalhealth.net
utc={2007-04-26 18:01:59.472+00:00}
om={
UID=3a7affd6-f420-11db-80b1-
AlertCode=AEM001
AlertType=AEM-default
AppName=AEM-CommonService2
Message=5004:An error has been reported by the
BIPXML4C component.:XML
}





__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: unit messages

2007-05-01 Thread oryann9

 #!/usr/bin/perl
 
 use strict;
 use warnings;
 
 my @a = qw(abc def ghi);
 
 for my $s (@a) {
 $s =~ /(b)|(e)|(h)/;
 print 1 = [$1] 2 = [$2] 3 = [$3]\n;
 }
 

Thank you for the kind replies. I understand now and
have modified the code to:

use strict;
use warnings;

my $jfsFile =
qq(/home/dbsmith/onlinJFS_4_license_exp.txt);
my $CvsFile =
qq(/home/dbsmith/onlinJFS_4_license_exp.cvs);
my $regexp  = qr/(host:\w+)/is;
my $regexp1 = qr/(onlinejfs.*)/is;
my $regexp2 = qr/(jfs\sversion.*)/is;

open (JFS, +$jfsFile) or die file '$jfsFile' was
not opened $!;

while (JFS) {
s/^\s+|\s+$//g; ## rid of newlines at
begin and end
next if ! length $_;## skip line of length
undef

if (/$regexp/) {
print \n$1\n,
'-' x length $1;
}
elsif (/$regexp1/) {
print \n\t$1\n;
}
elsif (/$regexp2/) {
print \n\t$1\n;
}
}



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: unit messages

2007-05-01 Thread oryann9
  Why are you creating these regexes so far from
 where
  they are used?
  If you are going to do this at least give them
  meaningful names.


I dont have a good reason Chas other than I like the
ability to easily change the variable in one spot in
case of future use.
If this is not a good reason, then guess it is
style.
:)
 
  
  use the three argument version of open, if you
 don't
  you will
  eventually be bitten by a file name that contains
  information that
  open thinks is part of the mode:
  
  open JFS, +, $jfsFile or die file '$jfsFile'
 was
  not opened $!;
  
  Also, you may consider using lexical varaibles
  instead of bareword file handles:
  
  open my $jfs, , $jfsFile or die file
 '$jfsFile'
  was not opened $!;
 
  it is easy to misread if ! so use unless
 instead. 
  Also length works
  on $_ if no argument is passed to it.
  
  next unless length;
 
 
All is understood and well taken. 
thx 

 pu  

Oryan the Cat [[derek]] .
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




unit messages

2007-04-30 Thread oryann9
Please advise on the small amount of code b/c I am
getting the message as below, but the code is working
and output how I want it, just trying to rid of
messages.

thank you!


Use of uninitialized value in concatenation (.) or
string at
JFS_version_parser.pl line 20, JFS line 952 (#1)

Use of uninitialized value in concatenation (.) or
string at
JFS_version_parser.pl line 21, JFS line 952 (#1)

Use of uninitialized value in concatenation (.) or
string at
JFS_version_parser.pl line 21, JFS line 956 (#1)

Use of uninitialized value in concatenation (.) or
string at
JFS_version_parser.pl line 22, JFS line 956 (#1)


use strict;
use warnings;
use diagnostics;

my $jfsFile = qq(/tmp/onlinJFS_4_license_exp.txt);
my $CvsFile = qq(/tmp/onlinJFS_4_license_exp.cvs);
my $regexp  =
qr/(host:\w+)|(onlinejfs.*)|(jfs\sversion.*)/is;
my ($host,$swlist,$kernel) = 0;

open (JFS, +$jfsFile) or die file '$jfsFile' was
not opened $!;

while (JFS) {
s/^\s+|\s+$//g;
next if ! length $_;

if (/$regexp/) {
($host,$swlist,$kernel) = ($1, $2, $3);
print \n$1;
print \t$2;
print $3\n;
}
}

__DATA__

---
HOST:axyz
---

You have mail.
logout

# OnlineJFS B.11.11   
Online features of the VxFS File System
  OnlineJFS.VXFS-ADV-RUNB.11.11   
VXFS-ADV-RUN
# PHCO_258311.0   
SCSI Ultra160 driver Online Addition script
  SW-DIST.SD-JPN-E-HELP B.11.11.0212  
Japanese EUC Online Help for SD
  SW-DIST.SD-JPN-S-HELP B.11.11.0212  
Japanese SJIS Online Help for SD
  X11.X11-RUN-CL-MANB.11.11   
Online manual pages for X11 clients
  X11.X11-RUN-CT-MANB.11.11   
Online manual pages for X11 contrib clients
  X11.X11-RUN-MAN   B.11.11   
Online manual pages for X11 clients


  OnlineDiagB.11.11.09.11  HPUX
11.11 Support Tools Bundle, Dec 2002


JFS version loaded in Kernel: $Revision: libvxfs.a:
CUPI80_BL2000_1108_2 Wed Nov 8 10:59:22 PST 2000 $
Connection to closed.

---
HOST:xyxxx
---

__DesiredOutput__

HOST:xyzzz

OnlineJFS B.11.11 Online features of the VxFS File
System

OnlineJFS.VXFS-ADV-RUN  B.11.11 VXFS-ADV-RUN

JFS version loaded in Kernel: $Revision: libvxfs.a:
CUPI80_BL2000_1108_2 Wed Nov 8 10:59:22 PST 20
00 $


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: reqular expr for string manip.

2007-04-20 Thread oryann9
 Mumia W. schreef:
 
  my $lang = ($topdir =~ /([^\/]+)$/)[0];
 
 ITYRMSL:
 
   my ($lang) = $topdir =~ m~([^/]+)$~;
 
 -- 

Dr Rudd, 

I have never seen the expression m~ or $~
Will you tell me what this is and what is says?

thank you


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Nested loop

2007-04-20 Thread oryann9
--- Chas Owens [EMAIL PROTECTED] wrote:

 On 4/19/07, John W. Krahn [EMAIL PROTECTED] wrote:
  Chas Owens wrote:
   Yes, foreach was aliased to for for backwards
 compatibility,
 
  Huh?  Do you have something to back up that claim?
 
 Well, perlsyn* says
The foreach keyword is actually a synonym
 for the for keyword, so
you can use foreach for readability or
 for for brevity.  (Or
because the Bourne shell is more familiar to
 you than csh, so writing
for comes more naturally.)
 
 But Synopsis 4* says
There is no foreach statement any more. It's
 always spelled for
 in Perl 6,
so it always takes a list as an argument
 
 So, you can either start training yourself to say
 for instead of
 foreach now or wait for culture shock down the road.
 

It really does not matter to me which one I use b/c
they both work well and seem to produce the same
results in all my tested code.  Its like asking me
would you like that coffee with cream/sugar or black.
ANSWER: I like coffee black and with cream/sugar, it
does not matter much and it all depends upon my mood.

Interesting though I ran perl -MO=Deparse on this
code...

[EMAIL PROTECTED] /cygdrive/c/temp
$ cat foo1
for my $i (0 .. 3) {
   $i *= 3;
   print $i,\n;
}
print \n\n;
for my $i (map { $_ * 3 } 0 .. 3) {
print $i\n;
}

$ perl -MO=Deparse foo1
foreach my $i (0 .. 3) {
$i *= 3;
print $i, \n;
}
print \n\n;
foreach my $i (map {$_ * 3;} 0..3) {
print $i\n;
}
foo1 syntax OK

So is foreach really dead or going away?
BTW Great write up Chas!

$ perl -v

This is perl, v5.8.7 built for
cygwin-thread-multi-64int
(with 1 registered patch, see perl -V for more detail)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Nested loop

2007-04-20 Thread oryann9
--- Chas Owens [EMAIL PROTECTED] wrote:

 On 4/20/07, John W. Krahn [EMAIL PROTECTED] wrote:
 snip
  You are omitting one critical argument.  For
 people who are stuck with older
  versions of Perl and in your grep() example above
 the foreach expression
  creates its list in memory which may cause the
 program to die if the list is
  large enough while the C style for loop does not
 have this problem.
 snip
 
 I refuse to let the fact that some people
 cannot/will not upgrade
 their copy of Perl affect how I code or advise
 others to code.  There
 are still people who wrtie/maintain Perl4 scripts,
 should I not tell
 people to use the strict pragma?  Even IBM is
 shipping a modern Perl
 with AIX now.
 
 
I agree with Chas and can support the AIX notion as I
work on AIX 5.3 machines which is the latest AIX.

But I did not see any response about:

Interesting though I ran perl -MO=Deparse on this
code...
So will foreach really be going away?


$ cat foo1
for my $i (0 .. 3) {
   $i *= 3;
   print $i,\n;
}
print \n\n;
for my $i (map { $_ * 3 } 0 .. 3) {
print $i\n;
}

$ perl -MO=Deparse foo1
foreach my $i (0 .. 3) {
$i *= 3;
print $i, \n;
}
print \n\n;
foreach my $i (map {$_ * 3;} 0..3) {
print $i\n;
}
foo1 syntax OK






__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Where Clause Help.

2007-04-18 Thread oryann9

 
 I am trying to select items from a table where the
 miles field is not
 null or blank and the below statement does not work.
  Does anyone have
 any suggestions?

 @resultkeys =
 (Date,People,Miles,Savings);
 
 $sql = SELECT c.objectid,c.dateadded as
 \Date\,c.totalpeople as \People\, ;
 
 $sql .= c.miles as Miles, c.totalsaved
 as \Savings\ ;
 
 $sql .= FROM OWNER.CONFERENCE c;
 
 $sql .=  WHERE c.miles  ;
 
 $sql .=  ORDER BY c.datestart;


Katie, 

sorry to say, but this is not a SQL list rather a Perl
list. However, the correct statement needs to be...

WHERE c.miles IS NULL;

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Bandwidth Generated

2007-04-13 Thread oryann9

 
 It works fine with 5.8.8 on my Fedora Core 5:
 
 $ perl -e 'for (,abc\n,def,hij\n){print;
 warn tell STDOUT,\n}'
 0
 abc
 4
 7
 defhij
 11
 $
 

Does not seem to be accurate on this platform???

$ uname -a
CYGWIN_NT-5.1 dubmdsmith10 1.5.24(0.156/4/2)
2007-01-31 10:57 i686 Cygwin

$ perl -e 'for (,abc\n,def,hij\n){print; warn
tell STDOUT,\n };'
-1
abc
-1
-1
defhij
-1



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Text munging problem

2007-04-06 Thread oryann9

$field =~ s/\b(.)(.*?)\b/\u$1\L$2/g;
$record .= $field|;
**

Is this regex s/\b(.)(.*?)\b/ saying boundry between
any character zero or more times in $1 up to
everything else non-greedy end word boundry in $2

sort of confused since your end goal is to CAPS first
letter in words.



 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: perl 5.10 questions

2007-04-04 Thread oryann9


 But this is all fairly complicated stuff and
 probably a little advanced
 for a beginners list.  You might find more joy
 asking on
 comp.lang.perl.moderated, or perlmonks.
 
 -- 
 Paul Johnson - [EMAIL PROTECTED]


yes but there are a lot of advanced members on the
list. ok thanks for responding!


 

Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Using case in Perl

2007-04-04 Thread oryann9
---
 
 Perl doesn't have the switch control statement.
 But you can get it by looking at CPAN:

http://search.cpan.org/~rgarcia/Switch-2.13/Switch.pm
 

To share some information in the up-incoming Perl 5.10
there will be a replacement for the switch clause.

The given-when is the Perl answer to the switch
(or case) keyword in other programming languages.
It replaces Switch.pm, which was a pre-Perl 5.10
source filter that did the same thing but didn't
always
work correctly.

#!/usr/bin/perl
use feature qw(say switch);
chomp( my $var = STDIN );
   given( $var ) {
  when( /\D/ ){ 
 say Needs a number!}
 when( $_ == 1 ) { 
 say Got 1! 
 }
 when( $_ == 2 ) { 
 say Got 2!
 }
 default { 
 say You said $_ 
 }
} ## END given


 

Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




perl 5.10 questions

2007-04-03 Thread oryann9
In The Perl Review spring 07 page 10 it states:

With Perl 5.10 I can write my own lexical pragmas.
In fact, feature was implemented this way. The
%^H special variable lets me attach references to
the optree, which I can then inspect with caller.
Perl passes this information as a new item in the
return list for caller: a hash reference of pragma
settings.

Questions:
1) What is the optree and how is it useful?
2) What is the official name for %^H
3) Using caller, what is element 10 in the code below?
   I looked in Programming Perl (w/out hope) and did
   not find it.

($package, $filename, $line, $subr, $has_args,
$wantarray )= caller($i);
#   0 1 2   3   4  5


CODE AS BELOW:

package foomagazin;
use feature qw(say ~~);
sub import{
   $^H{german} = 1 if @_ ~~ 'german';
}

sub unimport{
   $^H{german} = 0 if @_ ~~ 'german';
}

sub hello_world{
   my $hash = (caller(0))[10];
   if( $hash-{german} ) {
  say Hallo Welt!;
   }
   else {
  say Hello World!;
   }
}
1;

thank you


 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: perldoc -q How can I make my Perl program run faster?

2007-03-23 Thread oryann9

--- Jay Savage [EMAIL PROTECTED] wrote:

 On 3/22/07, oryann9 [EMAIL PROTECTED] wrote:
 
   This really isn't a Perl question, though. If
 you
   have questions about
   dynamic vs. static linking, and why you might
 want
   to do one or the
   other, you should probably pick up a good book
 on C
   and/or the C
   compiler on your system.
  
   HTH,
  
   -- jay
 
 
  thank you for responding, however I have to
 disagree
  with you in that this is not a Perl question
 because
  it is, otherwise perldoc -q would not have this
 info.
  In addition it directly talks about options when
  installing Perl.
 
 I think you're having trouble keeping your Perls
 straight. There are
 several things that go by the name /[Pp]erl/, and
 this list is about
 Perl, the programming language. It is not a place
 for a discussion of
 compiling C code or linking C libraries, even if the
 C projects are
 named perl or libperl. Why? Because 1) the
 questions are about
 compiling and executing C code, not about writing
 and executing Perl
 code; 2) the questions are about tuning a specific
 (C-langauge)
 program in a particular environment, not about
 general Perl language
 competency; and, 3) the questions are by any measure
 well beyond the
 scope of a beginners list.
 
 For a general questions about the pros and cons of
 dynamic vs. static
 linking, I would look at a good C language text
 book, For questions
 about compiling, linking, and debugging the Perl
 executable, I would
 look at comp.lang.perl.misc. For questions about
 tuning and
 maintaining a mod_perl installation, I would look at
 the mod_perl
 mailing list archives.
 
  So in general in a web environment with 8-12gb
 RAM,
  mod_Perl and a MySQL/Postgres backend, do you or
  people you know statically link libc.a?
 
 Do you statically link libc.a to your other
 applications? How much of
 that 8GB (or is it 12GB) of RAM is active at any
 given point? What
 else is the machine doing?
 
 Those are just a few of the questions that spring to
 mind.
 
 Again, this question isn't about Perl, it's a system
 administration
 question about server tuning. There is no answer
 other than what's
 right for your system, and probably no way to find
 that out other than
 trail and error. Only you know your system's average
 and peak load and
 memory consumption, etc. As the perlfaq makes clear,
 compiling a
 against a statically-linked libc will improve the
 performance of an
 individual perl interpreter, assuming that it's the
 only thing running
 on the system and there are sufficient resources
 available to
 accommodate the the increased resident memory. It is
 rare, though,
 that a single perl interpreter will be the only
 process running on a
 machine (in fact, it's impossible except in embedded
 applications).
 And neither the perlfaq nor anyone on this list can
 know whether your
 particular environment can support the configuration
 you propose. Only
 you know whether making changes to your Perl
 configuration will
 enhance or degrade your overall system performance.
 
 Again, though, this question isn't beginner
 anything, let alone beginner Perl.
 
 That you think it's a Perl question is an indication
 that you're
 probably heading down the wrong road.


It was just a general question as I was reading the
Perl docs. Didn't mean to strike anyones nerve, but
figured since there are expereinced people on this
list it was appropriate.





 

Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




perldoc -q How can I make my Perl program run faster?

2007-03-22 Thread oryann9
On this FAQ I read:

If you're currently linking your perl executable to a
shared libc.so, you can often gain a 10-25%
performance benefit by rebuilding it to
link with a static libc.a instead.  This will make a
bigger perl exe-cutable, but your Perl programs (and
programmers) may thank you for it.
See the INSTALL file in the source distribution for
more information.

All I found in the INSTALL file was this block of
text.

On some systems that support dynamic loading, it may
be possible to
replace libperl.a with a shared libperl.so.  If you
anticipate building
several different perl binaries (e.g. by embedding
libperl into
different programs, or by using the optional compiler
extension), then
you might wish to build a shared libperl.so so that
all your binaries
can share the same library.


Is this libc.a linking still true for Perl version
5.8?From perl -V I see:
Am I linked to libc.a?

 Linker and Libraries:
   ld='ld2', ldflags =' -s -L/usr/local/lib'
   libpth=/usr/local/lib /lib /usr/lib
   libs=-lgdbm -ldb -lcrypt -lgdbm_compat
   perllibs=-lcrypt -lgdbm_compat
   libc=/usr/lib/libc.a, so=dll, useshrplib=true,
   libperl=libperl.a
   gnulibc_version=''

thank you...



 

Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: perldoc -q How can I make my Perl program run faster?

2007-03-22 Thread oryann9
--- Chas Owens [EMAIL PROTECTED] wrote:

 On 3/22/07, oryann9 [EMAIL PROTECTED] wrote:
 snip
  Am I linked to libc.a?
 snip
 libc=/usr/lib/libc.a, so=dll, useshrplib=true,
 libperl=libperl.a
 snip
 
 It looks like it.  My perl says
 libc=/lib/libc-2.4.so, so=so, useshrplib=true,
 libperl=libperl.so.5.8.8
 
 it looks like you are using ActiveState Perl
 (so=dll), so you might
 try asking them.
 

yes I am using active state but that output was from
cygwin.
However this is NOT using libc.a on an HPUX.

Linker and Libraries:
ld='/usr/bin/ld', ldflags =''
libpth=/lib /usr/lib /usr/ccs/lib /usr/local/lib
libs=-lcres -lnsl -lnm -lndbm -lmalloc -ldld -lm
-lcrypt -lsec -lpthread -lc
perllibs=-lcres -lnsl -lnm -lmalloc -ldld -lm
-lcrypt -lsec -lpthread -lc
libc=/lib/libc.sl, so=sl, useshrplib=true,
libperl=libperl.sl
gnulibc_version=''

So in version 5.8 is this performance gain still true?

thx!


 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: perldoc -q How can I make my Perl program run faster?

2007-03-22 Thread oryann9

 This really isn't a Perl question, though. If you
 have questions about
 dynamic vs. static linking, and why you might want
 to do one or the
 other, you should probably pick up a good book on C
 and/or the C
 compiler on your system.
 
 HTH,
 
 -- jay


thank you for responding, however I have to disagree
with you in that this is not a Perl question because
it is, otherwise perldoc -q would not have this info.
In addition it directly talks about options when
installing Perl.
So in general in a web environment with 8-12gb RAM,
mod_Perl and a MySQL/Postgres backend, do you or
people you know statically link libc.a?




 

No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: template toolkit

2007-03-20 Thread oryann9
 oryann9 All, 
 oryann9 Is the Perl template toolkit a popular tool
 to use for
 oryann9 mid tier to senior Perl developers?
 
 I'm about as senior as they get for Perl developers
 {grin}, and it's clearly
 my templating language of choice.
 

OK great, Thx for responding! I read the CPAN module
and was a bit thrown for a minute b/c it has its own
sort of syntax and stanzas. see
http://search.cpan.org/~abw/Template-Toolkit-2.18/lib/Template/Tutorial/Web.pod

My next question is of those people that use is, how
sucessful has it been, meaning was mgmt happy with it,
were the developers happy with it?


 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




template toolkit

2007-03-19 Thread oryann9
All, 

Is the Perl template toolkit a popular tool to use for
mid tier to senior Perl developers?
Reason I ask is because from the description it states


And because it has its own simple templating
language, templates can be written and edited by
people who don't know Perl.


Among the many different approaches to templating
with Perl--such as Embperl, Mason, HTML::Template, and
hundreds of other lesser known systems--the Template
Toolkit is widely recognized as one of the most
versatile. Like other templating systems, the Template
Toolkit allows programmers to embed Perl code and
custom macros into HTML documents in order to create
customized documents on the fly. But unlike the
others, the Template Toolkit is as facile at producing
HTML as it is at producing XML, PDF, or any other
output format. And because it has its own simple
templating language, templates can be written and
edited by people who don't know Perl. In short, the
Template Toolkit combines the best features of its
competitors, with ease-of-use and flexibility,
resulting in a technology that's fast, powerful and
extensible, and ideally suited to the production and
maintenance of web content and other dynamic document
systems. 



 

Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




cgi Calendar continued.

2007-03-09 Thread oryann9
My goal is to correlate the data in 2 arrays into a
HoH or a HoA so that when I print this data in an HTML
table so it comes out correctly.
 

snippet...

my (@weeks, @weeks1, @weeks_AoA,) = ((),(),());

## Set up array with dates minus 15 days and plus 15
days from current date ##

foreach $day ('-15' .. '15') {
 run_statement( select date_format(date_add(curdate 
(), interval '$day' day), '%b %e, %Y'); );
push (@weeks, $sth-fetchrow);
} 

## Match up dates with dayofweek numbers with above
array ##

foreach $day1 ('-15' .. '15') {
 run_statement( select dayofweek(date_add(curdate(), 

interval '$day1' day)); );
push (@weeks1, $sth-fetchrow);
}

I then setup this hash:

my %WeekDays = (
1 = Sunday, 
2 = Monday,
3 = Tuesday, 
4 = Wednesday,
5 = Thursday, 
6 = Friday,
7 = Saturday
);

But my problem is figuring out which data structure to
use considering the following: correlate/match-up the
two array's data elements. For example, in @week an
element is 'Mar 9 2007' and its correlated element in
@weeks1 is '6' and 6 in %WeekDays is 'Friday.'
I see a HoH or a HoHoH ?

## To build:
my %HoH = ();
foreach my $dates (@weeks) {
foreach my $daynums (@weeks1) {
$HoH{$dates} = {
   daynums   = $daynums
   };
}
}

## To print:
for my $a ( keys %HoH ) {
for my $e ( keys %{ $HoH{ $a } } ) {
print $HoH{ $a }{ $e };
}
}

but its printing all 7's and 7 = Saturday in ODBC
standards.

Any advise?

thank you




 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: confused about a regex

2007-03-08 Thread oryann9
 $_=abc.e.i;
 
 This is short for:
 
 $_ = 'abc' . 'e' . 'i';
 
 Which is the same as saying:
 
 $_ = 'abcei';
 

Why is $_=abc.e.i short for 
$_ = 'abc' . 'e' . 'i';

Is it b/c each group of characters is a 'token'
including the periods? 

abc   = token 
. = token 
e = token 
. = token 
i = token

From the Perl CD:
the lexical analyzer breaks it down into three tokens:
print, Hello, world!\n, and the final semicolon/


 

Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: confused about a regex

2007-03-08 Thread oryann9

Yes I understand now. For some reason I missed the
missing quotes in the original post and the word token
came to mind.

$ perl -MO=Deparse foo.plx
BEGIN { $^W = 1; }
use diagnostics;
sub abc {
use warnings;
use strict 'refs';
'abc.';
}
sub e {
use warnings;
use strict 'refs';
'e.';
}
sub i {
use warnings;
use strict 'refs';
'i';
}
use warnings;
use strict 'refs';
$_ = abc() . e() . i();
print $_\n;
foo.plx syntax OK



 

Need Mail bonding?
Go to the Yahoo! Mail QA for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=listsid=396546091

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cgi calender

2007-03-02 Thread oryann9

 Why did you send me that link? That does not help
 me.
 
 Because you specifically said
 
 Will anyone offer some kind help?
 
 
 I use both sites to seek help when needed. I
 thought
 this was a list to get help because people here
 like
 to offer help after all we all love Perl?!  I did
 google cgi calender, but I am not going to copy
 someones code because that defeats the purpose of
 learning.
 

 
 Sorry if I aggravated you, but you sounded like
 someone
 begging for a free coding service, which this
 maillist is not.
 
 Once again, sorry,
 zentara
 
 

No apologies needed! I was not aggravated at all and
yes I do want to learn not just copy which is why I
use and watch this list.  Sorry for any misconceptions
and sorry for pissing anyone off.  I am a nice person
who has a drive to master Perl, but at the same time I
feel as if this list is against me b/c I do not write
my questions in the most ideal way.

derek (oryann9 = my all white cats name)
:)


 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cgi calender

2007-03-02 Thread oryann9

 More than this I cannot offer. I don't know what
 range of values your
 $dayofweek variable holds so I can't even guess what
 to code.
 
 Rob
 
No abuse was intended. Sorry.  I like to send my
thoughts on what to do for code to the list to see if
I get any feedback regardless of whether they are
right or wrong.



 

Need Mail bonding?
Go to the Yahoo! Mail QA for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=listsid=396546091

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cgi calender

2007-03-01 Thread oryann9

--- zentara [EMAIL PROTECTED] wrote:

 On Wed, 28 Feb 2007 12:10:36 -0800 (PST),
 [EMAIL PROTECTED] (oryann9)
 wrote:
 
 Will anyone offer some kind help?
 
 See:
 http://perlmonks.org?node_id=599419
 
 Or groups.google.com for perl html cgi calendar.
 
 zentara
 
 -- 

Why did you send me that link? That does not help me.
I use both sites to seek help when needed. I thought
this was a list to get help because people here like
to offer help after all we all love Perl?!  I did
google cgi calender, but I am not going to copy
someones code because that defeats the purpose of
learning.



 

No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: remove line if field one is duplicate

2007-03-01 Thread oryann9
--- Chas Owens [EMAIL PROTECTED] wrote:

 On 2/27/07, Keenan, Greg John (Greg)** CTR **
 [EMAIL PROTECTED] wrote:
  Hi,
 
  I have to combine several Unix password files and
 remove any duplicate
  accounts - putting this into LDAP.
 
  I have the following code that will remove any
 duplicate whole lines but
  I need to remove lines only if the first field of
 the password file is a
  duplicate.
 
 This should work
 
 perl -ne 'print unless $h{(split/:/)[0]}++'
 


This is creating a anonymous hash, correct?


 

We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: remove line if field one is duplicate

2007-03-01 Thread oryann9
--- Chris Charley [EMAIL PROTECTED] wrote:

 
  This is creating a anonymous hash, correct?
 
 This is saying
 print unless the first field has been seen before
 
 which is what he wants his code to do.
 
 $h is a good short notation - but using %seen
 instead of %h may make it clearer for you.
 
 perl -ne 'print unless $seen{(split/:/)[0]}++'
 
 Chris
 

I understand what its doing, but just wanted make sure
if its creating a anonymous hash b/c of the { }. So is
it b/c u never said yes or no? 

thank you


 

TV dinner still cooling? 
Check out Tonight's Picks on Yahoo! TV.
http://tv.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cgi calender

2007-02-28 Thread oryann9
--- Tom Phoenix [EMAIL PROTECTED] wrote:

 On 2/27/07, oryann9 [EMAIL PROTECTED] wrote:
 
  Problem: cgi calender daynames are not matching up
  with dates. For example: Todays date 02/27/2007 is
  being printed under Thursday instead of Tuesday.
 
 Is the problem that you need to determine the day of
 the week for a
 given date, or that you need to get something to
 line up vertically
 with something else?
 
 From looking briefly at your code, you seem to be
 using SQL to
 manipulate dates and times. In Perl, it's generally
 easier to use a
 module to do that. (Unless, of course, using SQL is
 part of the
 homework assignment.)
 
 --Tom Phoenix
 Stonehenge Perl Training
 

Tom, thank you for replying.  Well I solved the first
issue, determining the day of week for a given date
using select dayofweek(curdate()), so yes I am having
issues lining these days line up with dates b/c as the
days move forward the foreach $day ('-15' .. '15')
loop alters the table.  This is a homework assignment
for an online SQL class I am taking through O'reilly
for continuing education even though I work as a Unix Engineer.


 

Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cgi calender

2007-02-28 Thread oryann9
--- oryann9 [EMAIL PROTECTED] wrote:

 --- Tom Phoenix [EMAIL PROTECTED] wrote:
 
  On 2/27/07, oryann9 [EMAIL PROTECTED] wrote:
  
   Problem: cgi calender daynames are not matching
 up
   with dates. For example: Todays date 02/27/2007
 is
   being printed under Thursday instead of Tuesday.
  
  Is the problem that you need to determine the day
 of
  the week for a
  given date, or that you need to get something to
  line up vertically
  with something else?
  
  From looking briefly at your code, you seem to be
  using SQL to
  manipulate dates and times. In Perl, it's
 generally
  easier to use a
  module to do that. (Unless, of course, using SQL
 is
  part of the
  homework assignment.)
  
  --Tom Phoenix
  Stonehenge Perl Training
  
 
 Tom, thank you for replying.  Well I solved the
 first
 issue, determining the day of week for a given date
 using select dayofweek(curdate()), so yes I am
 having
 issues lining these days line up with dates b/c as
 the
 days move forward the foreach $day ('-15' .. '15')
 loop alters the table.  This is a homework
 assignment
 for an online SQL class I am taking through O'reilly
 for continuing education even though I work as a
 Unix Engineer.
 
 

Will anyone offer some kind help?




 

Looking for earth-friendly autos? 
Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




cgi calender

2007-02-27 Thread oryann9
All, 

I am having an issue getting my cgi calender to print
correctly. Any help or hints would be appreciated!
I was thinking of manipulating the @weeks_anonymous
array with select dayofweek(curdate()) rather than
using hardcoed undef's

Problem: cgi calender daynames are not matching up
with dates. For example: Todays date 02/27/2007 is
being printed under Thursday instead of Tuesday.

Sun Mon Tues Wed Thurs Fri Sat 
Feb 12, 07 Feb 13, 07 Feb 14, 07 Feb 15, 07 
Feb 16, 2007 Feb 17, 2007 Feb 18, 2007 Feb 19, 2007
Feb 20, 2007 Feb 21, 2007 Feb 22, 2007 
Feb 23, 2007 Feb 24, 2007 Feb 25, 2007 Feb 26, 2007
Feb 27, 2007 Feb 28, 2007 Mar 1, 2007 
Mar 2, 2007 Mar 3, 2007 Mar 4, 2007 Mar 5, 2007 Mar 6,
2007 Mar 7, 2007 Mar 8, 2007 
Mar 9, 2007 Mar 10, 2007 Mar 11, 2007 Mar 12, 2007 Mar
13, 2007 Mar 14, 2007  

wherein today the 27th lines up with Thursday when
executing this code.  I need it to correctly line up
with Tuesday.  Finally, I am unable to use
HTML::Calander modules so this is not an option.

#!/usr/bin/perl

use strict;
use warnings;

require dbi-lib.pl;  
use CGI qw/:standard *table start_ul/,
(-unique_headers);
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $cgi = new CGI;
local $sth;

#--#
# Function calls   #
#--#

print_header();
initialize_dbi();

##
# Begin Main #
##


print $cgi-header(),
  $cgi-start_html ('Oreilly SQL Class, Lesson
11'),   # Header
  $cgi-h1 ({-style='Color:blue'},'Derek\'s SQL
Class');  # Body

  print u,$cgi-strong('Date/Time CGI
Table:'),/up;
  print $cgi-caption('MySQL calendar table
output, Lesson 11:');
  print p;
  
  run_statement( select date_format(curdate(),
'%b %e, %Y'); );
  my $today = $sth-fetchrow;

  run_statement(select dayofweek(curdate() ); );
  my $dayofweek = $sth-fetchrow;
  print $dayofweek;
  
  #run_statement( select
date_format(curdate()-2,'%W'); );
   
  #my $twodayago = $sth-fetchrow;
  #print $twodayago p;

my @WeekDays = qw(Sunday Monday Tuesday Wednesday
Thursday Friday Saturday);
my ($day,$week,)   = (0,0);
my (@weeks, @weeks_anonymous,) = ((),());

foreach $day ('-15' .. '15') {
run_statement( select
date_format(date_add(curdate(), interval '$day' day),
'%b %e, %Y'); );
push (@weeks, $sth-fetchrow);
} 

## Begin Table ##

print table({border=undef});
print Tr ({-align='CENTER',-valign='TOP'}, td
([EMAIL PROTECTED]));
@weeks_anonymous = ( 
 [undef, undef, $weeks[0], $weeks[1], $weeks[2],
$weeks[3] ],
 
[$weeks[4], $weeks[5], $weeks[6], $weeks[7],
$weeks[8],  $weeks[9],  $weeks[10] ],

 [$weeks[11], $weeks[12], $weeks[13], $weeks[14],
$weeks[15], $weeks[16], $weeks[17] ],

 [$weeks[18], $weeks[19], $weeks[20], $weeks[21],
$weeks[22], $weeks[23], $weeks[24]  ],

 [$weeks[25], $weeks[26], $weeks[27], $weeks[28],
$weeks[29], $weeks[30], $weeks[31] ],
 
);

foreach $element (@weeks_anonymous) {
print Tr({-align='CENTER',-valign='TOP'});
for $date (@{$element}) { 
if (! defined $date) { 
print td ('');
} 
elsif ($date eq $today) {   
print td(strong($date));  
} 
else {
print td ($date);
}
}
print $cgi-end_Tr;
}

print $cgi-end_html;


 


 

The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cgi calender

2007-02-27 Thread oryann9

--- oryann9 [EMAIL PROTECTED] wrote:

 All, 
 
 I am having an issue getting my cgi calender to
 print
 correctly. Any help or hints would be appreciated!
 I was thinking of manipulating the @weeks_anonymous
 array with select dayofweek(curdate()) rather than
 using hardcoed undef's
 
 Problem: cgi calender daynames are not matching up
 with dates. For example: Todays date 02/27/2007 is
 being printed under Thursday instead of Tuesday.
 
 Sun Mon Tues Wed Thurs Fri Sat 
 Feb 12, 07 Feb 13, 07 Feb 14, 07 Feb 15, 07 
 Feb 16, 2007 Feb 17, 2007 Feb 18, 2007 Feb 19, 2007
 Feb 20, 2007 Feb 21, 2007 Feb 22, 2007 
 Feb 23, 2007 Feb 24, 2007 Feb 25, 2007 Feb 26, 2007
 Feb 27, 2007 Feb 28, 2007 Mar 1, 2007 
 Mar 2, 2007 Mar 3, 2007 Mar 4, 2007 Mar 5, 2007 Mar
 6,
 2007 Mar 7, 2007 Mar 8, 2007 
 Mar 9, 2007 Mar 10, 2007 Mar 11, 2007 Mar 12, 2007
 Mar
 13, 2007 Mar 14, 2007  
 
 wherein today the 27th lines up with Thursday when
 executing this code.  I need it to correctly line up
 with Tuesday.  Finally, I am unable to use
 HTML::Calander modules so this is not an option.
 


I added some code to address this issue, a hash and an
array to store dayofweek numbers, but still trying to
figure out how to merge these two code additions to
solve the dates with dayname problem.

#!/usr/bin/perl

use strict;
use warnings;

require dbi-lib.pl;  
use CGI qw/:standard *table start_ul/,
(-unique_headers);
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $cgi = new CGI;
local $sth;

#--#
# Function calls   #
#--#

print_header();
initialize_dbi();

##
# Begin Main #
##


print $cgi-header(),
  $cgi-start_html ('Lesson 11'),
  $cgi-h1 ({-style='Color:blue'},'SQL Class');

  print u,$cgi-strong('Date/Time CGI
Table:'),/up;
  print $cgi-caption('MySQL calendar table
output, Lesson 11:');
  print p;
  
  run_statement( select date_format(curdate(),
'%b %e, %Y'); );
  my $today = $sth-fetchrow;

  run_statement(select dayofweek(curdate() ); );
  my $dayofweek = $sth-fetchrow;

  #run_statement( select
date_format(curdate()-2,'%W'); );
   
  #my $twodayago = $sth-fetchrow;
  #print $twodayago p;

my %WeekDays = (
Sunday= 1,
Monday= 2, 
Tuesday   = 3, 
Wednesday = 4,
Thursday  = 5, 
Friday= 6,
Saturday  = 7
);


my ($day, $day1, $week,)= (0,0,0);
my (@weeks, @weeks1, @weeks_anonymous,) = ((),(),());

## Set up array with dates minus 15 days and plus 15
days from current date ##

foreach $day ('-15' .. '15') {
run_statement( select
date_format(date_add(curdate(), interval '$day' day),
'%b %e, %Y'); );
push (@weeks, $sth-fetchrow);
} 

## Match up dates with dayofweek #'s ##

foreach $day1 ('-15' .. '15') {
run_statement( select
dayofweek(date_add(curdate(), interval '$day1' day));
);
push (@weeks1, $sth-fetchrow);
}


## Begin Table ##

print table({border=undef});
#print Tr ({-align='CENTER',-valign='TOP'});
@weeks_anonymous = ( 
 [$weeks[0], $weeks[1], $weeks[2], $weeks[3],
$weeks[4], $weeks[5], $weeks[6] ],
 [$weeks[7], $weeks[8], $weeks[9], $weeks[10],
$weeks[11], $weeks[12], $weeks[13] ],
 [$weeks[14], $weeks[15], $weeks[16], $weeks[17],
$weeks[18], $weeks[19], $weeks[20] ],
 [$weeks[21], $weeks[22], $weeks[23], $weeks[24],
$weeks[25], $weeks[26], $weeks[27] ],
 [$weeks[28], $weeks[29], $weeks[30], $weeks[31],
undef, undef, undef ], 
 );

foreach $element (@weeks_anonymous) {
print Tr({-align='CENTER',-valign='TOP'});
for $date (@{$element}) { 
if (! defined $date) { 
print td ('');
} 
elsif ($date eq $today) {   
print td(strong($date) );  
} 
else {
print td ($date);
}
}
print $cgi-end_Tr;
}

print $cgi-end_html;


 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




cgi calander

2007-02-26 Thread oryann9
Any hints or pointers would be appreciated! thank you

When the dates change my calendar gets thrown off. The
daynames and dates are not matching up. I tested this
by simply adding and subtracting 1 from the SQL call
curdate() +1 or curdate() -1. Shouldn't I be able to
manipulate the @weeks_anonymous array using the SQL
call select dayofweek(curdate()); rather than using
hardcoded undef's?

Here is my code: 

#!/usr/bin/perl

use strict;
use warnings;

require dbi-lib.pl;  
use CGI qw/:standard *table start_ul/,
(-unique_headers);
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $cgi = new CGI;
local $sth;

#--#
# Function calls   #
#--#

print_header();
initialize_dbi();

##
# Begin Main #
##


print $cgi-header(),
  $cgi-start_html ('SQL Lesson11'),  

  $cgi-h1 ({-style='Color:blue'},'SQL Class');
  print u,$cgi-strong('Date/Time CGI
Table:'),/up;
  print $cgi-caption('MySQL calendar table
output, Lesson 11:');
  print p;
  
  run_statement( select date_format(curdate(),
'%b %e, %Y'); );
  my $today = $sth-fetchrow;

  run_statement(select dayofweek(curdate() ); );
  my $dayofweek = $sth-fetchrow;
  print $dayofweek;
  
  #run_statement( select
date_format(curdate()-2,'%W'); );
   
  #my $twodayago = $sth-fetchrow;
  #print $twodayago p;

my @WeekDays = qw(Sunday Monday Tuesday Wednesday
Thursday Friday Saturday);
my ($day,$week,)   = (0,0);
my (@weeks, @weeks_anonymous,) = ((),());

foreach $day ('-15' .. '15') {
run_statement( select
date_format(date_add(curdate(), interval '$day' day),
'%b %e, %Y'); );
push (@weeks, $sth-fetchrow);
} 

## Begin Table ##

print table({border=undef});
print Tr ({-align='CENTER',-valign='TOP'}, td
([EMAIL PROTECTED]));
@weeks_anonymous = ( 
 [ undef, undef, $weeks[0], 
$weeks[1],  $weeks[2],  $weeks[3] 
 ],
 [ $weeks[4],  $weeks[5], 
$weeks[6],  $weeks[7],  $weeks[8],  $weeks[9], 
$weeks[10]  ],
 [ $weeks[11], $weeks[12],
$weeks[13], $weeks[14], $weeks[15], $weeks[16],
$weeks[17]  ],
 [ $weeks[18], $weeks[19],
$weeks[20], $weeks[21], $weeks[22], $weeks[23],
$weeks[24]  ],
 [ $weeks[25], $weeks[26],
$weeks[27], $weeks[28], $weeks[29], $weeks[30],
$weeks[31]  ],
 
  );

foreach $element (@weeks_anonymous) {
print Tr({-align='CENTER',-valign='TOP'});
for $date (@{$element}) { 
if (! defined $date) { 
print td ('');
} 
elsif ($date eq $today) {   
print td(strong($date));  
} 
else {
print td ($date);
}
}
print $cgi-end_Tr;
}

print $cgi-end_html;


 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




using ssmtp to send mail from Intel cygwin platform

2007-02-07 Thread oryann9
Hello...: )
   
  I am having issues sending mail from within a perl script on an intel using 
the cygwin platform; the code is simply not sending email.
  CYGWIN_NT-5.1 laptop 1.5.23(0.156/4/2) 2006-12-19 10:52 i686 Cygwin
   
   
  snippet...
   
  qx(/usr/sbin/ssmtp $user  $log);
  system(/usr/sbin/ssmtp $user  $log) or warn email did not send $!;
  'ssmtp $user  $log`;
  I then tried to just type in the email recipient and file w/out using 
variables and this did not work.
  I did verify the log and user variables were being parsed correctly via print 
[$user]\t[$log];
   
  I have tried using qx, system, ` ` and require calling a file that has the 
ssmtp command in it to no success. I receive no warnings or errors.
  I then tried using MIME::Lite and it does not send and no errors or warnings.
   
  However, the command alone from my cygwin prompt does send mail after 
configuring ssmtp via /usr/bin/ssmtp-config.
  ssmtp [EMAIL PROTECTED]  /cygdrive/c/temp/test.txt
   
   
  Does anyone know what it could be or know of any known issues with this 
action of having Perl send mail using ssmtp on an cygwin platform?
   
   
  thank you

 
-
Any questions?  Get answers on any topic at Yahoo! Answers. Try it now.

Re: regexp... weird results

2007-02-02 Thread oryann9
Jay Savage [EMAIL PROTECTED] wrote:On 2/1/07, oryann9 wrote:
 oryann9 wrote: Hello Perl list,

[snip]

 I was able to figure it out. The solution was /s.
 my $regexp = qr/.*\x3a5101.*/s;

 However, when I put multiple port numbers in the regexp it does NOT work.
 I want to store them in memory for later use which is why I am using 
 1,2,3,4...
 my $regexp = qr/(.*\x3a5101.*)(.*\x3a5051.*)(.*\x3a3191.*)(.*\x3a1026.*)/s;

Take another look at perlre and perlretut.

That says, roughly:

You haven't included an or method anywhere; in order for a string to
match your pattern, it has to contain all four complete elements.

Also, why '\x3a' instead of ':'? and finally, if you're looking
anywhere in the string, you don't need '.*' on both sides of the
expression.

You're probably looking for something like

/:5101|:5051|:3191|:1026/
# or to capture the port number:
/:(5101|5051|3191|1026)/

perlre has the details on '|'.

HTH,

**
  Jay, thanks for the reply.  I am aware of the bit | operator and I tried 
using that prior to posting this message, but was having issues then.  I will 
try again.

 
-
Access over 1 million songs - Yahoo! Music Unlimited.

regexp... weird results

2007-02-01 Thread oryann9
Hello Perl list, 
   
  I need to grab from an intel machine all lines with :5101 from netstat -a.
  If I dont group the regexp using parens then it prints all the needed lines.
  If I group the regexp using parens then it does not print all the needed 
lines.
  Any help and an explanation...I am confused now.
  thank you
   
   
  my $regexp =  qr/.*\x3a5101.*/;
  open (NS, $ns -|)  or die system call netstat '$ns' failed: $!;
  print Looking for 3191\t1026\t5051\t5101\n\n;
  
while (NS) {
next if m|local\w+\x3a\d+|i;
if (/$regexp/) {
print $_;
  }
  }
   
  OR
  
while (NS) {
next if m|local\w+\x3a\d+|i;
if (m|(.*\x3a5101.*)|g) {
print ($1);
  }
  }

 
-
Sucker-punch spam with award-winning protection.
 Try the free Yahoo! Mail Beta.

Re: regexp... weird results

2007-02-01 Thread oryann9
oryann9 [EMAIL PROTECTED] wrote:Hello Perl list, 

I need to grab from an intel machine all lines with :5101 from netstat -a.
If I dont group the regexp using parens then it prints all the needed lines.
If I group the regexp using parens then it does not print all the needed lines.
Any help and an explanation...I am confused now.
thank you


my $regexp = qr/.*\x3a5101.*/;
open (NS, $ns -|) or die system call netstat '$ns' failed: $!;
print Looking for 3191\t1026\t5051\t5101\n\n;

while () {
next if m|local\w+\x3a\d+|i;
if (/$regexp/) {
print $_;
}
}

OR

while () {
next if m|local\w+\x3a\d+|i;
if (m|(.*\x3a5101.*)|g) {
print ($1);
}
}

***
   
  I was able to figure it out.  The solution was /s.
  my $regexp = qr/.*\x3a5101.*/s;

  However, when I put multiple port numbers in the regexp it does NOT work.
  I want to store them in memory for later use which is why I am using 
1,2,3,4...
  my $regexp = qr/(.*\x3a5101.*)(.*\x3a5051.*)(.*\x3a3191.*)(.*\x3a1026.*)/s;
   
   
   any help please?


 
-
Everyone is raving about the all-new Yahoo! Mail beta.

regexp

2007-01-31 Thread oryann9
In this regexp
   
  my $regexp  = qr/(\d+\x3a1108
  |\w+\x3a1108{1,} ) /;
   
  vs.
   
  my $regexp1  = qr/(\d+\x3a1108
  |\w+\x3a1108){1,} /;
   
  does the {1,} construct outside the parens () mean the entire string 1 or 
more times and within the parens mean only the last string \x3s1180 1 or more 
times?
   
  What is the diff?
   
  thank you. 

 
-
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.

Re: regexp

2007-01-31 Thread oryann9


John W. Krahn [EMAIL PROTECTED] wrote:oryann9 wrote:
 In this regexp
 
 my $regexp = qr/(\d+\x3a1108
 |\w+\x3a1108{1,} ) /;
 
 vs.
 
 my $regexp1 = qr/(\d+\x3a1108
 |\w+\x3a1108){1,} /;
 
 does the {1,} construct outside the parens () mean the entire string 1
 or more times and within the parens mean only the last string \x3s1180
 1 or more times?
 
 What is the diff?

Modifiers affect the preceding character or grouping so in the first example
the modifier is attached to the character '8' and in the second example the
modifier is attached to the parentheses which will affect the entire contents
of the enclosing parentheses.

Also note that \d is a subset of \w so anything that matches \w will also
match \d.


John
-- 

  ok did not know the subset info.  
  thx agn!




  
-
Looking for earth-friendly autos? 
 Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.  

port blocking on a wintel box

2007-01-26 Thread oryann9
Is there a way to block certain ports using Perl?
  If so please send me snippet sample code and or recommend module name to get 
me started.
   
  thank you
   

 
-
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel 
bargains.

HoH and HoHoH

2007-01-12 Thread oryann9

HoH
  
  'jblow' = {
 'uid' = '2195',
 'gecos' = 'Joe Blow,,,',
 'gid' = '20'
   },

  snippet.
   
   ( $name, $p, $uid, $gid, $gecos, $dir, $s ) = split( ':' );
$hash1{$name} - {'uid'} = $uid;
$hash1{$name} - {'gid'} = $gid;
$hash1{$name} - {'gecos'} = $gecos;

   
   
  HoHoH
--
$VAR1 = {
  'jblow' = {
 '2195' = {
 'gecos' = 'Joe Blow,,,',
 'gid' = '20'
   }
   }
};

  snippet..
   
$hash2{$name}{$uid} = {
   gid = $gid,
   gecos = $gecos,
};

   
  so that I grasp hashes and understand them more, in the first printed 
dump of HoH, there are 2 hashes called hash1 and name.  Hash hash1 
has a key of name with values of uid,gid and gecos? uid,gid and gecos 
are accessed only through name?
   
  in the printed dump of HoHoH, there are 3 hashes called hash2, 
name and uid. Hash hash2 has keys of name and uid with values of gid 
and gecos?  gid and gecos are only accessible through hash uid?
   
  please provide any corrections.
  thank you


 
-
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.

Re: remove duplicate lines

2007-01-11 Thread oryann9


Dr.Ruud [EMAIL PROTECTED] wrote:   beast schreef:

 a 100
 a 102
 c 100
 a 102
 b 111
 c 100
 c 102
 c 100
 c 100
 a 102
 ...
 
 I would like to have a list (either array or hash) with unique line .

perl -ne'$_{$_}||=print' datafile 

or

perl -pe'$_ x=!$$_++' datafile

-- 
Affijn, Ruud
  
what are these exactly doing in plain english?
  1st line is not printing and second it is, but gets confusing at ||= in the 
1st line and at !$ in 2nd line.
   
  thank you

 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

HoH and HoHoH

2007-01-11 Thread oryann9
HoH
  
  'jblow' = {
 'uid' = '2195',
 'gecos' = 'Joe Blow,,,',
 'gid' = '20'
   },

  snippet.
   
   ( $name, $p, $uid, $gid, $gecos, $dir, $s ) = split( ':' );
$hash1{$name} - {'uid'} = $uid;
$hash1{$name} - {'gid'} = $gid;
$hash1{$name} - {'gecos'} = $gecos;

   
   
  HoHoH
--
$VAR1 = {
  'jblow' = {
 '2195' = {
 'gecos' = 'Joe Blow,,,',
 'gid' = '20'
   }
   }
};

  snippet..
   
$hash2{$name}{$uid} = {
   gid = $gid,
   gecos = $gecos,
};

   
  so that I grasp hashes and understand them more, in the first printed dump of 
HoH, there are 2 hashes called hash1 and name.  Hash hash1 has a key of name 
with values of uid,gid and gecos? uid,gid and gecos are accessed only through 
name?
   
  in the printed dump of HoHoH, there are 3 hashes called hash2, name and 
uid. Hash hash2 has keys of name and uid with values of gid and gecos?  gid 
and gecos are only accessible through hash uid?
   
  thank you

 
-
Want to start your own business? Learn how on Yahoo! Small Business.

HoH and HoHoH

2007-01-11 Thread oryann9
HoH
  
  'jblow' = {
 'uid' = '2195',
 'gecos' = 'Joe Blow,,,',
 'gid' = '20'
   },

  snippet.
   
   ( $name, $p, $uid, $gid, $gecos, $dir, $s ) = split( ':' );
$hash1{$name} - {'uid'} = $uid;
$hash1{$name} - {'gid'} = $gid;
$hash1{$name} - {'gecos'} = $gecos;

   
   
  HoHoH
--
$VAR1 = {
  'jblow' = {
 '2195' = {
 'gecos' = 'Joe Blow,,,',
 'gid' = '20'
   }
   }
};

  snippet..
   
$hash2{$name}{$uid} = {
   gid = $gid,
   gecos = $gecos,
};

   
  so that I grasp hashes and understand them more, in the first printed dump of 
HoH, there are 2 hashes called hash1 and name.  Hash hash1 has a key of name 
with values of uid,gid and gecos? uid,gid and gecos are accessed only through 
name?
   
  in the printed dump of HoHoH, there are 3 hashes called hash2, name and 
uid. Hash hash2 has keys of name and uid with values of gid and gecos?  gid 
and gecos are only accessible through hash uid?
   
  thank you

 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: remove duplicate lines

2007-01-11 Thread oryann9


Dr.Ruud [EMAIL PROTECTED] wrote:oryann9 schreef:
 Dr.Ruud wrote: beast schreef:
 beast:

 a 100
 a 102
 c 100
 a 102
 b 111
 c 100
 c 102
 c 100
 c 100
 a 102
 ...

 I would like to have a list (either array or hash) with unique line
.

 perl -ne'$_{$_}||=print' datafile

 what are these exactly doing in plain english?
 1st line is not printing and second it is, but gets confusing at ||=
in the 1st line and at !$ in 2nd line

First see the output of

perl -MO=Deparse -ne'$_{$_}||=print' datafile

which returns:

LINE: while (defined($_ = )) {
$_{$_} ||= print($_);
}


See `perldoc perlrun` for the meaning of the -n option.


Let me simplify the code, to this equivalent:

while ( )
{
$d{$_} ||= print($_);
}

For every unique line of the input (the datafile) an entry to the
hash-table %d is added, with the whole line as the key-value. The
belonging value is set to the return value of print, which is 1 (if the
print went OK).

But if the key already exists, this is all skipped, because of the ||=
operator, see `perldoc perlop`. This operator sets the lvalue to the
rvalue, but only if the lvalue isn't true. So the loop is similar to

while ( )
{
next if $d{$_};
print;
$d{$_} = 1;
}

And that was my explanation of perl -ne'$_{$_}||=print'.

-- 
Affijn, Ruud


   
  cool!  thanks, now I understand.


 
-
Want to start your own business? Learn how on Yahoo! Small Business.

  1   2   >