[31524] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2783 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 22 16:09:47 2010

Date: Fri, 22 Jan 2010 13:09:09 -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, 22 Jan 2010     Volume: 11 Number: 2783

Today's topics:
        (La)TeX books <john@castleamber.com>
    Re: BEGIN and lexicals <bmb@mail.libs.uga.edu>
    Re: BEGIN and lexicals <uri@StemSystems.com>
    Re: BEGIN and lexicals <RedGrittyBrick@spamweary.invalid>
    Re: FAQ 7.28 How do I clear a package? <brian.d.foy@gmail.com>
        help with perl search/replace regex <globalsec@hotmail.com>
    Re: help with perl search/replace regex <globalsec@hotmail.com>
    Re: help with perl search/replace regex <jurgenex@hotmail.com>
    Re: help with perl search/replace regex <globalsec@hotmail.com>
        How to dissect a Regexp object? <no.email@please.post>
    Re: How to dissect a Regexp object? <derykus@gmail.com>
    Re: How to taint a variable (for testing) <no.email@please.post>
    Re: Inline::C + -T problem <no.email@please.post>
    Re: need some help excluding with file::find::rule <someone@example.com>
    Re: need some help excluding with file::find::rule <globalsec@hotmail.com>
        User-defined substitution <hjp-usenet2@hjp.at>
    Re: User-defined substitution sln@netherlands.com
        writing to terminal even with STDOUT and STDERR redirec <dilbert1999@gmail.com>
    Re: writing to terminal even with STDOUT and STDERR red <m@rtij.nl.invlalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 22 Jan 2010 11:32:21 -0600
From: John Bokma <john@castleamber.com>
Subject: (La)TeX books
Message-Id: <87y6jq59lm.fsf_-_@castleamber.com>

Eric Pozharski <whynot@pozharski.name> writes:

> I'm afraid that Lamport's book is quiet valuable but somewhat
> outdated.

Any tips on more up to date book(s)?

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


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

Date: Fri, 22 Jan 2010 08:01:05 -0500
From: Brad Baxter <bmb@mail.libs.uga.edu>
Subject: Re: BEGIN and lexicals
Message-Id: <hjc7ig$9mh$1@news.telesweet.net>

On 1/21/2010 9:12 AM, cate wrote:
> I have a large list of my vars that I would like to get out of the
> way; place them at the end of the script - kinda a class thing.
>
> Is there a way to use BEGIN some how?   Something like this.  I
> suspect you can't, but I'm asking the pros.
>
> use strict;
> code using $var1 ...
> code using $var1 ...
> more code
>
>
> BEGIN {
>    my $var1 = 'sfsdf';
>    my $var2 = 'sdfsdf';
> }
>
> thank you

You have gotten advice against wanting to do this,
and I concur that your motives are perhaps dubious.

But to answer the specific question, you just need
to declare the lexicals at the top and assign them
in the BEGIN block at the bottom *without* my.

      1  #!/usr/local/bin/perl
      2
      3  use warnings;
      4  use strict;
      5
      6  my $var1;
      7  my $var2;
      8
      9  print "$var1, $var2\n";
     10
     11  exit;
     12
     13  BEGIN {
     14    $var1 = 'Hello';
     15    $var2 = 'World';
     16  }
     17
     18  __END__
     19  Hello, World

-- 
Brad


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

Date: Fri, 22 Jan 2010 10:23:00 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: BEGIN and lexicals
Message-Id: <87bpgmgo4r.fsf@quad.sysarch.com>

>>>>> "BB" == Brad Baxter <bmb@mail.libs.uga.edu> writes:

  BB> On 1/21/2010 9:12 AM, cate wrote:
  >> I have a large list of my vars that I would like to get out of the
  >> way; place them at the end of the script - kinda a class thing.


  BB> But to answer the specific question, you just need
  BB> to declare the lexicals at the top and assign them
  BB> in the BEGIN block at the bottom *without* my.

then you don't solve his problem of a large list of vars at the
beginning of the script!

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Fri, 22 Jan 2010 15:50:48 +0000
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: BEGIN and lexicals
Message-Id: <4b59c95a$0$2481$db0fefd9@news.zen.co.uk>


cate wrote:
> I have a large list of my vars that I would like to get out of the
> way; place them at the end of the script - kinda a class thing.
> 
> Is there a way to use BEGIN some how?   Something like this.  I
> suspect you can't, but I'm asking the pros.
> 
> use strict;
> code using $var1 ...
> code using $var1 ...
> more code
> 
> 
> BEGIN {
>   my $var1 = 'sfsdf';
>   my $var2 = 'sdfsdf';
> }
> 

As Uri and Jürgen suggested, I'd try hard not to have a large list of 
vars anywhere. I'd declare variables in the smallest useful scope, near 
where they are used.

If forced to have a large list, since I prefer not the have BEGIN blocks 
at the end - I'd try something like:

-----------------------------8<-------------------------------
#!perl
use strict;
use warnings;

{ # to restrict scope of %vars

   my %vars = getVars();
   # ...
   print $vars{'var1'};
   # ...
}

sub otherSub {
   # no use of %vars possible here as it's lexical & hence out of scope?
}

sub getVars {
   return (
     var1 => 'sfsdf',
     var2 => 'sdfsdf'
   )
}
-----------------------------8<-------------------------------

Which I think avoids creating/using global variables

-- 
RGB


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

Date: Fri, 22 Jan 2010 13:32:50 -0600
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 7.28 How do I clear a package?
Message-Id: <220120101332503348%brian.d.foy@gmail.com>

In article <lnr5pl8re0.fsf@nuthaus.mib.org>, Keith Thompson
<kst-u@mib.org> wrote:


> Well, I can tell what it is by looking at the code, but why would you
> want to do that?  Is the Question really Asked all that Frequently?

Since I've started answering Perl questions at Stackoverflow, I've
discovered that all the Perl questions I thought weren't frequently
asked anymore really are still asked.

It's sorta like asking why you need so many cops when you have no
crime. :)


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

Date: Fri, 22 Jan 2010 10:26:36 -0800 (PST)
From: solaristar <globalsec@hotmail.com>
Subject: help with perl search/replace regex
Message-Id: <f6dbc701-8691-46ff-a1cd-777187bd5aa0@q4g2000yqm.googlegroups.com>

So i have a file with a line

foo_bar_baz (some amount of whitespace) 100 (a number)

I basically want to have a search regex that searches foo_bar_baz(and
then to the end of the line regardless of what text)

and replace it with foo_bar_baz \t (tab) 101 (some dif number

---

my command is as such but isnt working

perl -i -pe 's/minutes_between_backups$/minutes_between_backups
\t1020/' /etc/myconffile*.conf

I thought $ matched to the end of the line?



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

Date: Fri, 22 Jan 2010 11:00:36 -0800 (PST)
From: solaristar <globalsec@hotmail.com>
Subject: Re: help with perl search/replace regex
Message-Id: <4913bf4f-2e59-42db-99d8-bdb857ee9b46@h2g2000yqj.googlegroups.com>

On Jan 22, 10:26=A0am, solaristar <global...@hotmail.com> wrote:
> So i have a file with a line
>
> foo_bar_baz (some amount of whitespace) 100 (a number)
>
> I basically want to have a search regex that searches foo_bar_baz(and
> then to the end of the line regardless of what text)
>
> and replace it with foo_bar_baz \t (tab) 101 (some dif number
>
> ---
>
> my command is as such but isnt working
>
> perl -i -pe 's/minutes_between_backups$/minutes_between_backups
> \t1020/' /etc/myconffile*.conf
>
> I thought $ matched to the end of the line?

figured it out

perl -i -pe 's/minutes_between_backups.*/minutes_between_backups\t
\t1020/' /etc/myconf*.conf

thanks to

http://www.comp.leeds.ac.uk/Perl/matching.html


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

Date: Fri, 22 Jan 2010 12:11:23 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: help with perl search/replace regex
Message-Id: <fe1kl5d33frk7o5e0oeqectqa9co0c1apc@4ax.com>

solaristar <globalsec@hotmail.com> wrote:
>So i have a file with a line
>
>foo_bar_baz (some amount of whitespace) 100 (a number)
>
>I basically want to have a search regex that searches foo_bar_baz(and
>then to the end of the line regardless of what text)
>
>and replace it with foo_bar_baz \t (tab) 101 (some dif number
>
>my command is as such but isnt working
>
>perl -i -pe 's/minutes_between_backups$/minutes_between_backups
>\t1020/' /etc/myconffile*.conf

/minutes_between_backups/ will never match 'foo_bar_buz'.

>I thought $ matched to the end of the line?

It matches the end of the line itself. If you want to match whatever
text between the current position and the end of the line then simply
use '.*'.

jue


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

Date: Fri, 22 Jan 2010 12:15:28 -0800 (PST)
From: solaristar <globalsec@hotmail.com>
Subject: Re: help with perl search/replace regex
Message-Id: <e051ba05-d0c6-433a-a12e-18a7da83a646@u41g2000yqe.googlegroups.com>

On Jan 22, 12:11=A0pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> solaristar <global...@hotmail.com> wrote:
> >So i have a file with a line
>
> >foo_bar_baz (some amount of whitespace) 100 (a number)
>
> >I basically want to have a search regex that searches foo_bar_baz(and
> >then to the end of the line regardless of what text)
>
> >and replace it with foo_bar_baz \t (tab) 101 (some dif number
>
> >my command is as such but isnt working
>
> >perl -i -pe 's/minutes_between_backups$/minutes_between_backups
> >\t1020/' /etc/myconffile*.conf
>
> /minutes_between_backups/ will never match 'foo_bar_buz'.
>
> >I thought $ matched to the end of the line?
>
> It matches the end of the line itself. If you want to match whatever
> text between the current position and the end of the line then simply
> use '.*'.
>
> jue

yup thanks i figured it out a bit after i posted hehe, i was using the
foo_bar_baz as an example of the text, not as the literal text :)
thanks for the reply though



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

Date: Fri, 22 Jan 2010 17:54:49 +0000 (UTC)
From: kj <no.email@please.post>
Subject: How to dissect a Regexp object?
Message-Id: <hjcop9$7p0$2@reader1.panix.com>




Is there a way to tell if a given Regexp object, generated at
runtime, includes at least one pair of capture parentheses?

More generally, is there any documentation for the Regexp class?
(I'm referring to the class alluded to by the output of, e.g., ref
qr//).  Running perldoc Regexp fails ("no docs found"), and perldoc
perlre does not say much at all about this class as such.

TIA!

Kynn


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

Date: Fri, 22 Jan 2010 12:26:23 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: How to dissect a Regexp object?
Message-Id: <2bc6e22c-2a39-46e6-84bc-7f3e8cac2108@a15g2000yqm.googlegroups.com>

On Jan 22, 9:54=A0am, kj <no.em...@please.post> wrote:
> Is there a way to tell if a given Regexp object, generated at
> runtime, includes at least one pair of capture parentheses?
>
> More generally, is there any documentation for the Regexp class?
> (I'm referring to the class alluded to by the output of, e.g., ref
> qr//). =A0Running perldoc Regexp fails ("no docs found"), and perldoc
> perlre does not say much at all about this class as such.
>

perldoc perlop (see: Regexp Quote-Like Operators)

The regex object is viewable as a string:

  $ perl -le '$regex =3D qr/ab(\d+)/; print $regex'
  (?-xism:ab(\d+))

--
Charles DeRykus



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

Date: Fri, 22 Jan 2010 17:47:40 +0000 (UTC)
From: kj <no.email@please.post>
Subject: Re: How to taint a variable (for testing)
Message-Id: <hjcobs$7p0$1@reader1.panix.com>

In <7d5n27-b512.ln1@osiris.mauzo.dyndns.org> Ben Morrow <ben@morrow.me.uk> writes:


>Quoth sreservoir <sreservoir@gmail.com>:
>> On 1/21/2010 3:19 PM, kj wrote:
>> > For testing purposes I would like to be able to intentionally taint
>> > a variable.  What's the easiest way to do this?
>> 
>> $string .= substr($taint, 0, 0);

>And, for reference, $^X is always tainted.

>There are also various modules on CPAN with Taint in their names, some
>of which will let you turn taint mode on/off and taint/untaint variables
>directly.

Ben, sreservoir, thanks for your replies!

~K


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

Date: Fri, 22 Jan 2010 16:04:28 +0000 (UTC)
From: kj <no.email@please.post>
Subject: Re: Inline::C + -T problem
Message-Id: <hjciac$cv0$1@reader1.panix.com>




Ben, Rob, thanks for your suggestions!

~K



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

Date: Fri, 22 Jan 2010 04:37:23 -0800
From: "John W. Krahn" <someone@example.com>
Subject: Re: need some help excluding with file::find::rule
Message-Id: <b_g6n.6170$k96.3580@newsfe25.iad>

solaristar wrote:
> 
> First please forgive me if this is the wrong way to go about asking
> this question.
> 
> I have a script im working on that is looking to only get the
> filenames with ".mw.|.cw.|.uw." and exclude any filenames (which
> happen to be FQDNs of servers) that do not have that criteria
> 
> the structure to search is /data*/backups/$server/daily.0/$server
> (where $server would have the .mw.|.cw.|.uw. characteristic)

It looks like you could use a file glob to get the list of file names 
you need, for example (UNTESTED):

my $server = '.[cmu]w';

my @files = glob "/data*/backups/$server/daily.0/*$server";


> this is what I have thus far, I dont feel this is the fastest way to
> go about doing this (im not sure), I also want to make sure to exclude
> and not even "parse" any dirs that dont have the afore mentioned
> criteria,
> 
> any feedback is appreciated
> 
> ====
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> use File::Find::Rule;
> use File::Basename qw/basename dirname/;
> 
> my @data_dir =
>   qw { /data/backups };    # list here the data dir if you want to
> loop on it.
> foreach my $dir (@data_dir) {
> print "looking at $dir..\n";
>     my ( $bkpcount, $dbcount ) = 0;    # db and backup file counter

That is the same as saying:

       my $bkpcount = 0;
       my $dbcount;

If you want both variables initialized to 0 then you have to assign to both:

      my ( $bkpcount, $dbcount ) = ( 0, 0 );

Or:

      my ( $bkpcount, $dbcount ) = ( 0 ) x 2;

Or:

      my $bkpcount = my $dbcount = 0;


>     # Gather server name with .mw, .cw, .uw on fqdn
>  my %server_w_log;
> # This part will search for every  directory with .mw, .uw. cw and
> take the base name as key to hash
>     opendir( DIR, $dir ) or warn "can't open $dir\n";

You should include the $! variable in the error message so you know why 
opendir() failed.


>     my @servers = readdir(DIR);

Even though opendir() failed you are still trying to read from the 
invalid directory handle?


>     foreach my $server (@servers) {
>         next if $server =~ m/^\./;
>         %server_w_log =
>           map { my $tempfile = basename $_; $tempfile => $_ }
>           File::Find::Rule->directory->name(qr/.*\.(mw|uw|cw).*/)

The '.*' at the beginning and end are superfluous, it should be just 
qr/\.(mw|uw|cw)/, or even better qr/\.[muc]w/.


>           ->in("$dir/$server/daily.0");
> 
> print "server is $server..\n";
> 
>     }
>     close(DIR);
> ..etc...
> 
> (there's more to the script but this is the first part that's giving
> me problems.
> 
> any help is greatly appreciated.



John
-- 
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway


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

Date: Fri, 22 Jan 2010 10:42:26 -0800 (PST)
From: solaristar <globalsec@hotmail.com>
Subject: Re: need some help excluding with file::find::rule
Message-Id: <85ec4db9-0771-4bcc-8f1e-da8aa0a4054e@22g2000yqr.googlegroups.com>

John,

thanks for the reply, ok so i read your notes and tried to incorporate
them, I must still be doing something wrong as i still get non ",[muc]
w." servers listed via the last print

here's the code

#!/usr/bin/perl

use strict;
use warnings;
use File::Find::Rule;
use File::Basename qw/basename dirname/;

$|=1;

my @data_dir =
  qw { /data/backups };    # list here the data dir if you want to
loop on it.
foreach my $dir (@data_dir) {
print "looking at $dir..\n";

my $server = '.[cmu]w';
my @files = glob "/data*/backups/$server/daily.0/$server";

my ( $bkpcount, $dbcount ) = ( 0, 0 );

my %server_w_log;
    opendir( DIR, $dir ) or warn "can't open $dir\n";
    my @servers = readdir(DIR);
    foreach my $server (@servers) {
        next if $server =~ m/^\./;
        %server_w_log =
          map { my $tempfile = basename $_; $tempfile => $_ }
          File::Find::Rule
          ->directory
          ->name(qr/\.[muc]w/)
          ->in("$dir/$server/daily.0");

print "server is $server..\n";

    }
    close(DIR);

}





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

Date: Fri, 22 Jan 2010 16:01:25 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: User-defined substitution
Message-Id: <slrnhljfe6.n1k.hjp-usenet2@hrunkner.hjp.at>

I want to provide non-trusted users with a way to make substitutions
similar to s///. To my surprise this isn't an FAQ (although there is a
similar problem - "How can I expand variables in text strings?"), but
maybe I shouldn't be surprised because this is the first time I needed
to do that myself ;-).


So here is what I came up with - please try to shoot it down:


sub replace {
    my ($string, $pattern, $replacement) = @_;

    if (my @m = $string =~ m/$pattern/p) {
        for my $i (1 .. @m) {
            $replacement =~ s/\$$i(?=\D|)/$m[$i-1]/e;
        }
        return ${^PREMATCH} . $replacement . ${^POSTMATCH};
    } else {
        return $string;
    }
}

All three strings are potentially untrusted ($string comes from a
database query, $pattern and $replacement are supplied by the user.

The function should do the same as
    $string =~ s/$pattern/$replacement/;
except that $<number> references to capture buffers are resolved, too.

I think this is safe:

 * The match itself should be safe unless "use re 'eval'" is active 
   (it isn't).
 * The s///e only evaluates to $m[$i-1], it doesn't evaluate the
   content, so it cannot be used to inject code.

There is one catch, though: If $pattern doesn't contain any capturing
parentheses, @m is set to (1) on a successful match, which isn't
distinguishable from a pattern which captures one string "1". I guess I
could try to analyze $pattern or just document that at least one set of
parentheses must be used.

Did I miss something? Is there a simpler way?

	hp



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

Date: Fri, 22 Jan 2010 09:54:02 -0800
From: sln@netherlands.com
Subject: Re: User-defined substitution
Message-Id: <8oojl5llrdmgant0m2oj5murg3pp4b18aj@4ax.com>

On Fri, 22 Jan 2010 16:01:25 +0100, "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:

>I want to provide non-trusted users with a way to make substitutions
>similar to s///. To my surprise this isn't an FAQ (although there is a
>similar problem - "How can I expand variables in text strings?"), but
>maybe I shouldn't be surprised because this is the first time I needed
>to do that myself ;-).
>
>
>So here is what I came up with - please try to shoot it down:
>
>
>sub replace {
>    my ($string, $pattern, $replacement) = @_;
>
>    if (my @m = $string =~ m/$pattern/p) {
>        for my $i (1 .. @m) {
>            $replacement =~ s/\$$i(?=\D|)/$m[$i-1]/e;
>        }
>        return ${^PREMATCH} . $replacement . ${^POSTMATCH};
>    } else {
>        return $string;
>    }
>}
>
>All three strings are potentially untrusted ($string comes from a
>database query, $pattern and $replacement are supplied by the user.
>
>The function should do the same as
>    $string =~ s/$pattern/$replacement/;
>except that $<number> references to capture buffers are resolved, too.
>

I don't know what you are trying to resolve re:
    "except that $<number> references to capture buffers are resolved, too."
Can you elaborate?

my ($Str,$Pat,$Rep) = (
  "and \$this end",
  "(\\\$this)",
  "\$1\$1\$1"
);
print "\nStr: '$Str'\nPat: '$Pat'\nRepl:'$Rep'\n\n";
my $res = replace ($Str,$Pat,$Rep);
print "Str = '$res'\n";
---
Out:
Str: 'and $this end'
Pat: '(\$this)'
Repl:'$1$1$1'
Str = 'and $this$1$1 end'
---
Which I think is incorrect. It remains to be seen wheather
the above $Str,$Pat,$Rep can actually get in this form via
console though.


>I think this is safe:
>
> * The match itself should be safe unless "use re 'eval'" is active 
>   (it isn't).
> * The s///e only evaluates to $m[$i-1], it doesn't evaluate the
>   content, so it cannot be used to inject code.
>
>There is one catch, though: If $pattern doesn't contain any capturing
>parentheses, @m is set to (1) on a successful match, which isn't
>distinguishable from a pattern which captures one string "1". I guess I
>could try to analyze $pattern or just document that at least one set of
>parentheses must be used.
>
>Did I miss something? Is there a simpler way?
>
>	hp

I don't know about how safe this is. Croaking on code could be as bad as
injecting code.
Also, only very simple s&r can be done and with no modifiers.
Though the /p modifier and ${^PREMATCH} . $replacement . ${^POSTMATCH}
are a good start.

It would be easier if it were just for programmed usage, then its
at your own risk. Its hard to imagine this could be safely made robust
for command line usage. I could be wrong.

-sln


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

Date: Fri, 22 Jan 2010 09:31:46 -0800 (PST)
From: Dilbert <dilbert1999@gmail.com>
Subject: writing to terminal even with STDOUT and STDERR redirected
Message-Id: <76d51e7d-e18f-4ec3-b335-349308878c87@l30g2000yqb.googlegroups.com>

I have a first perl-program ("first.pl") that calls a second perl-
program ("second.pl") and captures STDOUT and STDERR.
Is there a way inside "second.pl" to magically open a filehandle to
the terminal, even though STDOUT and STDERR are both redirected ?
I'm working under Ubuntu Linux.

first.pl
======
use strict;
use warnings;
system 'perl second.pl >file1.txt 2>file2.txt';

second.pl
======
use strict;
use warnings;
print STDOUT "This is STDOUT\n";
print STDERR "This is STDERR\n";
open my $fh, '>', ??magic-terminal?? or die "Error: Can't open magic
terminal because $!";
print {$fh} "This is magically going to terminal\n";
close $fh;


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

Date: Fri, 22 Jan 2010 21:49:06 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: writing to terminal even with STDOUT and STDERR redirected
Message-Id: <2jfp27-704.ln1@news.rtij.nl>

On Fri, 22 Jan 2010 09:31:46 -0800, Dilbert wrote:

> I have a first perl-program ("first.pl") that calls a second perl-
> program ("second.pl") and captures STDOUT and STDERR. Is there a way
> inside "second.pl" to magically open a filehandle to the terminal, even
> though STDOUT and STDERR are both redirected ? I'm working under Ubuntu
> Linux.
> 
> first.pl
> ======
> use strict;
> use warnings;
> system 'perl second.pl >file1.txt 2>file2.txt';
> 
> second.pl
> ======
> use strict;
> use warnings;
> print STDOUT "This is STDOUT\n";
> print STDERR "This is STDERR\n";
> open my $fh, '>', ??magic-terminal?? or die "Error: Can't open magic
> terminal because $!";
> print {$fh} "This is magically going to terminal\n"; close $fh;

open my$fh, ">", "/dev/tty" or die ...

M4


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 2783
***************************************


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