[28968] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 212 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 9 21:10:28 2007

Date: Fri, 9 Mar 2007 18:09:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 9 Mar 2007     Volume: 11 Number: 212

Today's topics:
        Array Ref Error <doni.sekar@gmail.com>
        Convert IEEE single from integer representation <1usa@llenroc.ude.invalid>
        Dumping Perl tie hash file <ecarlson@vmware.com>
    Re: Dumping Perl tie hash file <bik.mido@tiscalinet.it>
    Re: Dumping Perl tie hash file <ecarlson@vmware.com>
    Re: Dumping Perl tie hash file xhoster@gmail.com
    Re: Dumping Perl tie hash file <ecarlson@vmware.com>
    Re: Error description. <glex_no-spam@qwest-spam-no.invalid>
    Re: MIME::Lite, getting a warning. <justin.0703@purestblue.com>
    Re: Net-SSH-W32Perl strange behaviour. <1usa@llenroc.ude.invalid>
        net::ssh and functions <usaims@yahoo.com>
    Re: net::ssh and functions <glex_no-spam@qwest-spam-no.invalid>
        Non-blocking directory watching <mmundy1@gmail.com>
    Re: Non-blocking directory watching xhoster@gmail.com
    Re: odd behavior between Guitest and rcmd on windows <1usa@llenroc.ude.invalid>
        script for sending email with experimental results <b83503104@yahoo.com>
    Re: Splitting a filename anno4000@radom.zrz.tu-berlin.de
        using a function with net::ssh <usaims@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 9 Mar 2007 16:54:23 -0800
From: "doni" <doni.sekar@gmail.com>
Subject: Array Ref Error
Message-Id: <1173488063.320571.64000@p10g2000cwp.googlegroups.com>

Hi,
	I am having some problem with ARRAY ref in my test program.
The test program contains multiple arrays to extract the data from the
output based upon certain conditions. I am also extracting an user
input to a variable where the user is expected to input any one of the
array names existing
in the program.
When I am trying to pass the user input variable to a subroutine as an
initialized array,  I am getting this error message: Can't use string
("junk") as an ARRAY ref while "strict refs".

Actually, what I am expecting to do is have the user input an already
existing array name in the program and pass that array name to a
subroutine.

Here is the program:

#! /usr/bin/perl

use strict;

my $ex_data = 'log_messages';
open (NETSTAT,$ex_data) || die("Cannot Open File: $!");

### Variables ###
my %gw_route = ();
my %route = ();
my %no_of_times = ();
my $segment;
my @new_device; my @route_update;
my @received_hello; my @removing_l2;
my $key; my $i;

### User Input
$segment = <STDIN>;
chomp($segment);

### ROUTE SUBROUTINE ###
sub route {
    my (@received_message) = @_;
    @received_message = split;
    if (/Received Hello/i) {
        push (@received_hello, $received_message[9]);
    }
    elsif (/Removing L2/) {
        push (@removing_l2, $received_message[9]);
        push @{$route{removing_l2}{$key}}, $received_message[9];
    }
    else {}
}

### GWD SUBROUTINE ###
sub gw_route {
    my (@received_message) = @_;
    @received_message = split;
    if (/Got ROUTE_UPDATE/i) {
        (my $gw_route_update = $received_message[7]) =~ s/address=/ /;
        push (@route_update, $gw_route_update);
        push @{$gw_route{route_update}{$key}}, $gw_route_update;
    }
}

### SUBROUTINE TO COUNT NO OF TIMES A PARTICULAR VALUE IS PRESENT IN
THE HASH
sub no_of_times {
    my (@mac_id) = @_;
    for $key (@mac_id) {
        $no_of_times{$key}++;
    }
    for $key (keys %no_of_times) {
        print "$no_of_times{$key} $key\n";
    }
}

while (<NETSTAT>) {
    chomp;
    if (/rfrouted/i) {
        route($_);
    }
    elsif (/gwd/i) {
        gw_route($_);
    }
}
close(NETSTAT) || die("Cannot close $ex_data: $!");
no_of_times(@$segment);	#### This is where I am creating an error


Thanks,
doni



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

Date: Sat, 10 Mar 2007 01:24:56 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Convert IEEE single from integer representation
Message-Id: <Xns98EECFAC05BE0asu1cornelledu@127.0.0.1>

Hello all:

In one of my programs, I had to read data that was saved in binary 
format. Some of the data consisted of IEEE 754 single precision floats 
saved as 32 bit integers (in network order). My pack/unpack skills are 
not that great (I don't think they can handle this case) so I wrote 
something to handle the conversion of these numbers.

I would very much appreciate if you can take a look at the code and see 
if I am doing anything that I should not be doing or if there is a 
better way of doing this.

The function in question is ieee_single_from_int in the string below.

The function is a straight-forward application of the manual steps 
needed to go from the integer representation to the floating point 
number.

I would like to know if there is an obvious way of doing this that I 
have missed or if there is a CPAN module that already handles these 
kinds of conversions. If not, I'll package this as a module and start 
preparing my first ever CPAN contribution ;-) 

You can use http://babbage.cs.qc.edu/IEEE-754/32bit.html to check for 
correctness. http://en.wikipedia.org/wiki/IEEE_754 explains the format.


#!/usr/bin/perl

use strict;
use warnings;

my $buffer;

# The following loop replaces the routine to read reasonably
# sized chunks from the file.

while ( my $line = <DATA> ) {
    my $hex;
    last unless ( $hex ) = ($line =~ /\A\d{7}: ([[:xdigit:] ]+)/);
    while ( $hex =~ /([[:xdigit:]]{2})/g ) {
        $buffer .= chr( hex $1 );
    }
}

for ( my $i = 0; $i < length $buffer; $i += 4 ) {
    my $uint32 = unpack 'N', substr( $buffer, $i, 4 );

    my ($v, $e) = ieee_single_from_int( $uint32 );

    if ( defined $v ) {
        printf "%8.8x : % .16f\n", $uint32, $v;
    }
    else {
        warn sprintf "%8.8x : %s\n", $uint32, $e;
    }
}

use constant DENOMINATOR => 0x00800000;
use constant UINT32_MASK => 0xffffffff;
use constant SIGN_MASK   => 0x80000000;
use constant FRAC_MASK   => 0x007fffff;
use constant EXP_MASK    => 0x7f800000;

sub ieee_single_from_int {
    my $uint32 = ( $_[0] & UINT32_MASK );
    my $exp    = ( $uint32 & EXP_MASK ) >> 23;
    my $frac   = $uint32 & FRAC_MASK;
    my $sign   = $uint32 & SIGN_MASK ;

    my ($v, $e);

    if ( $exp and $exp < 0xff ) {
        $v = ( 1 + $frac / DENOMINATOR ) * ( 2**( $exp - 127) );
    }
    elsif( $exp == 0x00 ) {
        $v = ( $frac / DENOMINATOR ) * ( 2**( -126 ) );
    }
    elsif( $exp == 0xff ) {
        $e = $frac ? "NaN"
           : $sign ? "-Infinity"
           :         "+Infinity";
    }

    $v = -$v if defined( $v ) and $sign;
    return wantarray ? ( $v, $e ) : $v;
}


__DATA__
0000420: 4016 2933 3f1b 739a be86 8200 c00d c853  @.)3?.s........S
0000430: bf18 7633 404a 3eba bfc5 b34d 3ea3 00a7  ..v3@J>....M>...
0000440: bfae 1e10 3e30 8d00 bfa0 02da bfb9 2bed  ....>0........+.
0000450: 3f33 66da bfbc 9b4d 3fa3 c200 c088 cd93  ?3f....M?.......
0000460: 40f2 5e4a 4005 5407 c086 b92a bf61 5f8a  @.^J@.T....*.a_.
0000470: bf2a 75da 3f5d 2a4d bf9a 1373 bfbd 475a  .*u.?]*M...s..GZ


Thank you for your time.

Sinan


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

Date: 9 Mar 2007 11:28:20 -0800
From: "Eric" <ecarlson@vmware.com>
Subject: Dumping Perl tie hash file
Message-Id: <1173468500.212935.303170@q40g2000cwq.googlegroups.com>

Hello,

This is a repost of sorts. The code below is putting the info in a
file, $mountsDBFile, but it's doing so in binary. The file has to be
humanly readable.

I got a couple of responses on this. Someone responded and said that
there are tools to translate the file, or I can write a Perl script to
run on the file. (I'm assuming they meant post processing of the
file.) I made desperate attempts to do the latter, but with no
success.

Does anyone know of any tools to do this, or how I would write a
script to interpret this file in humanly readable text? Again, I tried
everything I could come up with (too numerable to list here). I'm
afraid we don't have the time to rewrite the way Perl is dealing with
the database to write the info to the file in readable form.

Thanks in advance to all that respond.

Eric

=======================================

sub RequestMountPoint {
   my $self = shift;
   my $protocol = shift;
   my $bldNum = shift;
   my $mntPnt = undef;
   my $mountsDBFile = $self->Env->HomeDir()."/mountsDB";


   my $mntsDB = {};
   unless (open SEMAPHORE, "> /tmp/mounts.lock") {
      $self->Env->ReleaseMachines();
      die "unexpected problem allocating semaphore";
   }
   flock SEMAPHORE, Fcntl::LOCK_EX;


   tie( %$mntsDB, "MLDBM", $mountsDBFile, O_CREAT|O_RDWR, 0666,
$DB_File::DB_BTREE );


   my $mountPoint = $self->Config->MountPointCount();
   for (my $label = 0; $label < $mountPoint; $label++){
      $mntPnt = "xmnt".$label;
      unless (defined($mntsDB->{$mntPnt})){
         $mntsDB->{$mntPnt} = {
                                 BldNum => $bldNum,
                                 Protocol => $protocol,
                                 RefCnt => 1,
                              };
         last;
      }


      if (($mntsDB->{$mntPnt}->{BldNum} == $bldNum) and
          ($mntsDB->{$mntPnt}->{Protocol} eq $protocol)) {
         $mntsDB->{$mntPnt}->{RefCnt}++;
         last;
      }


      $mntPnt = undef;
   }
   my $ref = $mntsDB->{$mntPnt}->{RefCnt};


   untie(%$mntsDB);


   close(SEMAPHORE);


   return $mntPnt, $ref;



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

Date: Fri, 09 Mar 2007 22:59:18 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Dumping Perl tie hash file
Message-Id: <p1m3v21shge1pssnlu5irjrmu35ndm3929@4ax.com>

On 9 Mar 2007 11:28:20 -0800, "Eric" <ecarlson@vmware.com> wrote:

>Does anyone know of any tools to do this, or how I would write a
>script to interpret this file in humanly readable text? Again, I tried

Have you tried Data::Dumper, XML::Simple or YAML::Syck? How readable
is human readable enough for you?


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


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

Date: 9 Mar 2007 14:44:26 -0800
From: "Eric" <ecarlson@vmware.com>
Subject: Re: Dumping Perl tie hash file
Message-Id: <1173480266.579760.156320@h3g2000cwc.googlegroups.com>

On Mar 9, 1:59 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On 9 Mar 2007 11:28:20 -0800, "Eric" <ecarl...@vmware.com> wrote:
>
> >Does anyone know of any tools to do this, or how I would write a
> >script to interpret this file in humanly readable text? Again, I tried
>
> Have you tried Data::Dumper, XML::Simple or YAML::Syck? How readable
> is human readable enough for you?
>
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Thanks for your response, Michele. I have in fact tried Data::Dumper,
but with limited success. Not sure what XML::Simple could do for me
here. I've never heard of YAML::Syck, but I'll look into it.

Eric



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

Date: 09 Mar 2007 19:34:37 GMT
From: xhoster@gmail.com
Subject: Re: Dumping Perl tie hash file
Message-Id: <20070309194138.599$gQ@newsreader.com>

"Eric" <ecarlson@vmware.com> wrote:
> Hello,
>
> This is a repost of sorts. The code below is putting the info in a
> file, $mountsDBFile, but it's doing so in binary. The file has to be
> humanly readable.

Do you need to preserve the information in the existing file, or can you
just change the script to use a human readable format?


> I got a couple of responses on this. Someone responded and said that
> there are tools to translate the file, or I can write a Perl script to
> run on the file. (I'm assuming they meant post processing of the
> file.) I made desperate attempts to do the latter, but with no
> success.

First come up with a method that works to tie your hash to a human
readable file starting clean.  Only once you have that working should you
worry about porting the already-existing binary file into the new format
that you will be using going forward.


> Does anyone know of any tools to do this, or how I would write a
> script to interpret this file in humanly readable text? Again, I tried
> everything I could come up with (too numerable to list here).

Tell us about two of them.  Tell us in detail what problem you encountered.


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 9 Mar 2007 17:17:59 -0800
From: "Eric" <ecarlson@vmware.com>
Subject: Re: Dumping Perl tie hash file
Message-Id: <1173489478.901579.163580@q40g2000cwq.googlegroups.com>

Thanks for your response. My replies inline:

> Do you need to preserve the information in the existing file, or can you
> just change the script to use a human readable format?

I initially misunderstood the requirements. It turns out that the
database itself needs to be in text format. This is going to take a
lot more effort than I intially thought. Someone pointed out that
MLDBM is not the way to go about accomplishing this, and suggested
trying things such as SQLite. I'm going to have start investigating
this.

> First come up with a method that works to tie your hash to a human
> readable file starting clean.  Only once you have that working should you
> worry about porting the already-existing binary file into the new format
> that you will be using going forward.

Yes, that seems to be the solution. I just need to work on getting
there.

Eric



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

Date: Fri, 09 Mar 2007 14:00:13 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Error description.
Message-Id: <45f1bcfe$0$504$815e3792@news.qwest.net>

rajendra wrote:
> Hello All,
> 
> 
> The actual error is "Free to wrong pool 1c7ef28 not 15d2cb8 during global
> destruction." .
> 
> 
> The error mentioned below was due to the fact that I had included the
> package "Win32::OLE" in my code.

What did you find when you tried searching the Internet for a similar 
error?  e.g. "Free to wrong pool"


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

Date: Fri, 09 Mar 2007 18:56:08 -0000
From: Justin C <justin.0703@purestblue.com>
Subject: Re: MIME::Lite, getting a warning.
Message-Id: <slrnev3be7.lkq.justin.0703@stigmata.purestblue.com>

On 2007-03-09, Bart Lateur <bart.lateur@pandora.be> wrote:
> Justin C wrote:
>
>>my $fname = glob "pa206_*xls" ;
>
> Are you sure this matches anything? This looks like a real odd name for
> a ZIP file.

It matched something, the problem was, it matched more than one
something.

Thanks for looking.

	Justin.

-- 
Justin C, by the sea.


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

Date: Fri, 09 Mar 2007 20:52:41 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Net-SSH-W32Perl strange behaviour.
Message-Id: <Xns98EEA187EE069asu1cornelledu@127.0.0.1>

chenws3000@gmail.com wrote in
news:1173453663.133950.270590@n33g2000cwc.googlegroups.com: 

[ Full quote snipped. Don't do that. ]

 
> RE: How can I fix error message during the Perl script execution ?

Well, now, that's not the subject of this message, is it?

> I meet the same problem those days, and I try to find the solution
> from internet.

The posting guidelines for this group explain the best ways to make sure 
you can get useful responses to your questions.

> However, there are few info about this issue. So I decide to dug it by
> myself. When I debug the script into Carp.pm (version 1.04). I find
> the reason.
> 
> in line 271 just replace
> 
> sub carp    { warn shortmess @_ }
> 
> to
> 
> sub carp { }
> 
> all strange messages are gone.

Ammaaaaaaaaazing! Why didn't anyone else think of that before? Just 
silence the warnings and pretend everything is fine.

I am definitely impressed by your programming prowess. I especially like 
your brand new invisibility suit. Bye.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 9 Mar 2007 14:43:50 -0800
From: "usaims" <usaims@yahoo.com>
Subject: net::ssh and functions
Message-Id: <1173480230.572120.82220@s48g2000cws.googlegroups.com>

Hello:

This is my objective. I'm trying to ssh into a linux node, open a file
and display the contents on my  terminal, below is the code. I'm
getting the following error:
bash: -c: line 1: syntax error near unexpected token `0x91134c8'
bash: -c: line 1: `CODE(0x91134c8)'

Does anybody have a clue?
########################################
#!/usr/bin/perl -w
use warnings;
use strict;
use Net::SSH qw(ssh issh sshopen2 sshopen3);
my $variable = \&FUNCTION;

ssh('someuser@xxx.xxx.xxx', $variable );


sub FUNCTION {
open(FILE, "/stuff/log.txt");
print FILE;
}
########################################



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

Date: Fri, 09 Mar 2007 17:02:43 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: net::ssh and functions
Message-Id: <45f1e7c5$0$502$815e3792@news.qwest.net>

usaims wrote:
> Hello:
> 
> This is my objective. I'm trying to ssh into a linux node, open a file
> and display the contents on my  terminal, below is the code. I'm
> getting the following error:
> bash: -c: line 1: syntax error near unexpected token `0x91134c8'
> bash: -c: line 1: `CODE(0x91134c8)'
> 
> Does anybody have a clue?
> ########################################
> #!/usr/bin/perl -w
> use warnings;
> use strict;
> use Net::SSH qw(ssh issh sshopen2 sshopen3);
> my $variable = \&FUNCTION;
> 
> ssh('someuser@xxx.xxx.xxx', $variable );
> 
> 
> sub FUNCTION {
> open(FILE, "/stuff/log.txt");
> print FILE;
> }
> ########################################
> 

You'd be better off using the supported methods, which are well documented.

ssh('user@hostname', $command);

$command is a scalar. e.g. my $command = '/bin/ls /tmp';


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

Date: 9 Mar 2007 15:17:04 -0800
From: "Matthew" <mmundy1@gmail.com>
Subject: Non-blocking directory watching
Message-Id: <1173482224.649207.47510@30g2000cwc.googlegroups.com>

Hello all.

Is there a way to watch a directory for files w/o blocking?  I was
hoping there was something similar to select but I have found nothing.

inotify will not work b/c of the linux kernel requirement.  I'd like
to stay cross-platform

Thanks in advance.
---Matthew



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

Date: 09 Mar 2007 19:41:55 GMT
From: xhoster@gmail.com
Subject: Re: Non-blocking directory watching
Message-Id: <20070309194856.631$Te@newsreader.com>

"Matthew" <mmundy1@gmail.com> wrote:
> Hello all.
>
> Is there a way to watch a directory for files w/o blocking?  I was
> hoping there was something similar to select but I have found nothing.

I can't think of a way of watching a directory *with* blocking (I'd just do
polling which may be inefficient but doesn't block waiting for a change to
happen).  If you have such a method (efficient but blocking) in mind and
you share it with us, I might be able to help you make it nonblocking.

> inotify will not work b/c of the linux kernel requirement.  I'd like
> to stay cross-platform


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Sat, 10 Mar 2007 01:35:04 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: odd behavior between Guitest and rcmd on windows
Message-Id: <Xns98EED163F596Casu1cornelledu@127.0.0.1>

Mark Seger <Mark.Seger@hp.com> wrote in news:essaso$lsa$1@usenet01.boi.hp.com:

> I have a testing environment that is set up in such a way that after 
> logging into the PC, a window is displayed that waits for the user to 
> hit the ENTER key and then automaticall starts running a canned set of 
> tests.  This system also has rcmd set up on it for doing various mgmt 
> tasks such as rebooting it.  What I'd like to do is use rcmd to
> remotely run a local program that sends the ENTER to the system and so
> remotely start the tests running.

You should not assume that everyone knows what rcmd is. According to 

http://www.microsoft.com/technet/archive/winntas/support/advtshoot/x0a_tool.mspx?mfr=true

it allows you to interact with a Windows service that allows you to 
run commands remotely on a computer.

AFAIK, services don't automatically have the right to interact with the
desktop.

For your script, started using rcmd, to be able to interact with the 
desktop, you'll need to set it up that way.

I don't know much about how to do that and as such this is not a Perl
problem.

You might find useful information at

http://support.microsoft.com/kb/327618

Sinan


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

Date: 9 Mar 2007 11:47:15 -0800
From: "bahoo" <b83503104@yahoo.com>
Subject: script for sending email with experimental results
Message-Id: <1173469635.804646.33610@q40g2000cwq.googlegroups.com>

Hi,

I am running MATLAB code which typically takes a few hours, and I want
to send the results (typically just a series of numbers, such as 0.8
0.3) to my email account once its done.

Anyone has good suggestions on how this could be done?
Is it necessary to write like a Perl script?  Can anyone show me how
to?

Thanks!
bahoo



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

Date: 10 Mar 2007 00:02:42 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Splitting a filename
Message-Id: <55eat2F24br7fU1@mid.dfncis.de>

Michele Dondi  <bik.mido@tiscalinet.it> wrote in comp.lang.perl.misc:
> On Thu, 08 Mar 2007 21:46:42 +0100, Michele Dondi
> <bik.mido@tiscalinet.it> wrote:
> 
> >>    sub parsename {
> >>        for ( shift ) {
> >>            return($_, '') unless /\./;
> >>            return /^(.*)(\..*)$/;
> >>        }
> >>    }
> >
> >Oh, I'm a big fan of one shot C<for>s. But then I heard about lexical
> 
> And of course that could even be cast in the form of a single
> statement:
> 
>   sub parsename { return /\./ ? /^(.*)(\..*)$/ : $_, '' for shift }
> 
> Although just as obviously I would call that an *abuse*.
> :-)

It's not entirely equivalent, however.  The sub body is parsed as

    return ( /\./ ? /^(.*)(\..*)$/ : $_), '' for shift;

so it returns a spurious third value (an empty string) when an extension
is present.  This would do:

    return /\./ ? /^(.*)(\..*)$/ : ( $_, '') for shift;

It's probably better  to re-write the regex to capture the right stuff
in both cases.  Also, it shouldn't include the "." in the extension,
but that's secondary.

[an embarrassing amount of time passes]

This isn't as easy as I thought.  I haven't found a single regex
that captures first the name, and then the extension or an empty
string if there is none, in all cases.  I'll leave the solution as
an exercise.

It is possible to use two regexes only one of which ever matches,
but that's no improvement.

    sub parsename { return ( /(.*)\.(.*)/, /^([^.]*)()$/) for shift }

Anno




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

Date: 9 Mar 2007 14:35:42 -0800
From: "usaims" <usaims@yahoo.com>
Subject: using a function with net::ssh
Message-Id: <1173479742.096535.61030@v33g2000cwv.googlegroups.com>

Hello:

This is my objective. I'm trying to ssh into a linux node, open a file
and display the contents on my  terminal, below is the code. I'm
getting the following error:
bash: -c: line 1: syntax error near unexpected token `0x91134c8'
bash: -c: line 1: `CODE(0x91134c8)'

Does anybody have a clue?
########################################
#!/usr/bin/perl -w
use warnings;
use strict;
use Net::SSH qw(ssh issh sshopen2 sshopen3);
my $variable = \&FUNCTION;

ssh('someuser@xxx.xxx.xxx', $variable );


sub FUNCTION {
open(FILE, "/stuff/log.txt");
print FILE;
}
########################################



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

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


Administrivia:

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

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

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

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

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


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


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