[17986] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 146 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 25 21:05:44 2001

Date: Thu, 25 Jan 2001 18:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980474707-v10-i146@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 25 Jan 2001     Volume: 10 Number: 146

Today's topics:
    Re: Comparing multiple values (Damian Conway)
    Re: Date and time <paanwa@hotmail.com>
        Display graphics with AS Perl 5.6 <w-woerlinger@ti.com>
        Display graphics with AS Perl 5.6 <w-woerlinger@ti.com>
        Does DBI support Oracle long data type? henry00@my-deja.com
        Embedding Perl in Visual C++ tyronen@my-deja.com
        Form Processing - newbie question <paanwa@hotmail.com>
        Hash of hash of arrays problem (Lou Hevly)
    Re: How to compile a perl file ? (Tim Hammerquist)
        LWP/ Web Login Advice Needed <usdpd@jeeves.bimcore.emory.edu>
    Re: Passing parameters to a script <jdf@pobox.com>
    Re: pdf2html <zarathustra@enviroweb.org>
        Precision? (was: Perl is bad at (very) simple math!) <occitan@esperanto.org>
    Re: regex question <joe+usenet@sunstarsys.com>
    Re: right place for a mod_perl question? <dwb1@home.com>
        Script to "rotate" the chars in a string. (James Kufrovich)
    Re: Script to "rotate" the chars in a string. egwong@netcom.com
    Re: Script to "rotate" the chars in a string. <sumus@aut.dk>
    Re: simple question for probably all of you... about @ <sumus@aut.dk>
    Re: simple question for probably all of you... about @ <verdien_guldens@hotmail.com>
    Re: String comparing? (Martien Verbruggen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 26 Jan 2001 00:44:12 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Comparing multiple values
Message-Id: <94qh8s$kts$1@towncrier.cc.monash.edu.au>


"TA" == Tore Aursand <tore@extend.no> writes:

>  TA> In article <94pocs$osn$1@nnrp1.deja.com>, datastar@my-deja.com says...
>  >> ...but what if I want to test if $somevar equals 3,4,8 or 9?

I'm late to this thread, so I'm not sure if anyone has yet suggested:

	use Quantum::Superpositions;

	if ($somevar == any(3,4,8,9)) {
	    ...
	}

:-)

Damian


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

Date: Fri, 26 Jan 2001 00:35:15 GMT
From: "paanwa" <paanwa@hotmail.com>
Subject: Re: Date and time
Message-Id: <7D3c6.42567$_B2.4706539@typhoon.kc.rr.com>

Max,

Here is what worked for me, thanks to folks out there who gave me pointers.

($sec,$min,$hour,$mday,$mon,$year) =(localtime)[0..5];

$DateTime = sprintf("%04d/%02d/%02d %02d:%02d:%02d", $year+1900, $mon+1,
$mday, $hour, $min, $sec);

# Then you need to write the data to your file to the date file after you
have
#opened and locked the file

print FILE "$DateTime";





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

Date: Fri, 26 Jan 2001 00:44:49 +0100
From: "willi" <w-woerlinger@ti.com>
Subject: Display graphics with AS Perl 5.6
Message-Id: <94qe0n$jmj$1@tilde.csc.ti.com>

What choices do I have to display a graph in TK subwindow.
I used to generate a gif file with the GIFGraph module and
displayed it with Tk::Photo.

But with AS Perl 5.6 I can only use GD::Graph or Chart module,
which only create png or jpeg graphics.
And these cannot be displayed with Tk::Photo (at least I did not find
a way to do this).

I've found a way to convert the chart to gif format by using
Image::Magick, but this takes a very long time on every execution.

I cannot believe there are no other ways to display png
formated graphics in a subwindow with TK modules or functions.

Any help is appreciated.

Thanks,
Willi




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

Date: Fri, 26 Jan 2001 00:48:43 +0100
From: "willi" <w-woerlinger@ti.com>
Subject: Display graphics with AS Perl 5.6
Message-Id: <94qe0o$jmj$2@tilde.csc.ti.com>

What choices do I have to display a graph in TK subwindow.
I used to generate a gif file with the GIFGraph module and
displayed it with Tk::Photo.

But with AS Perl 5.6 I can only use GD::Graph or Chart module,
which only create png or jpeg graphics.
And these cannot be displayed with Tk::Photo (at least I did not find
a way to do this).

I've found a way to convert the chart to gif format by using
Image::Magick, but this takes a very long time on every execution.

I cannot believe there are no other ways to display png
formated graphics in a subwindow with TK modules or functions.

Any help is appreciated.

Thanks,
Willi






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

Date: Thu, 25 Jan 2001 23:36:22 GMT
From: henry00@my-deja.com
Subject: Does DBI support Oracle long data type?
Message-Id: <94qd9l$dkg$1@nnrp1.deja.com>

I use DBI to make a selection statement. When my selected columns have
long type (in Oracle table), it returned nothing. I knew there are
records. my code like this:
$sth = $dbh->prepare("select id, long_seq from my_seq_table where
id=?");
while(<IN>) { # id list
  chomp;
$sth->execute($_);
@fields = $sth->fetchrow_array;

Why there is no record with long_seq (datatye of long), but w/o it
everything OK.

Help please


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 23:28:16 GMT
From: tyronen@my-deja.com
Subject: Embedding Perl in Visual C++
Message-Id: <94qcq5$d50$1@nnrp1.deja.com>

I have ActivePerl 5.6 running on Windows 2000.  I would like to make
calls to the Perl interpreter from within a C++ program.

I try to compile the example match.c program found in the perlembed
documentation, and I can't get it to compile.  The compiler (Visual C++
6.0) insists the identifier "my_perl" is undefined, even though I see
it clearly in the source code.

Is there a bug in the code somewhere, or the ActivePerl header files?
Has anyone else had this problem?

Help appreciated.

TN


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 26 Jan 2001 00:05:13 GMT
From: "paanwa" <paanwa@hotmail.com>
Subject: Form Processing - newbie question
Message-Id: <Za3c6.42321$_B2.4697069@typhoon.kc.rr.com>

Hi all!

I am trying to take form data from checkboxes and write it to a text file.
Here are the rules I have been given:
A maximum of 5 checkboxes may be submitted (this is screened via
javascript).
A total of 5 entries in the data file must be submitted even if less than 5
checks have been selected by the user.

Here is an example of what must occur if only 3 checks are submitted:
(note the csv formatting)

print FILE "\"$in{'check1'}\","
print FILE "\"$in{'check2'}\","
print FILE "\"$in{'check3'}\","
print FILE "\"\","; #blank field
print FILE "\"\","; #blank field - this makes a total of 5 entries.

Any guidance would be appreciated.

Remember, I am a newbie and am afraid of big words......




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

Date: Fri, 26 Jan 2001 01:37:07 GMT
From: lou@visca.com (Lou Hevly)
Subject: Hash of hash of arrays problem
Message-Id: <3a70d484.279086675@news.wanadoo.es>

Greetings:
I don't understand why I'm getting the following results:
In the first case, using a simple scalar as the value of a nested
hash, I get the results I anticipate: a ref to a *copy* of the %data
hash as the value of each %domains hash key.

my %data = (
	du_w => 'Disk Usage: Web',
	du_m => 'Disk Usage: Mail',
	tot_du => 'Total Disk Usage',
	);
my %domains = map {$_ => {%data} } grep !/^\.\.?/ -d, readdir D;

Gets me (using Data Dumper):
$VAR1 = 'anticbressol';
$VAR2 = {
          'tot_du' => 'Total Disk Usage',
          'du_w' => 'Disk Usage: Web',
          'du_m' => 'Disk Usage: Mail'
        };
$VAR3 = 'boixados';
$VAR4 = {
          'tot_du' => 'Total Disk Usage',
          'du_w' => 'Disk Usage: Web',
          'du_m' => 'Disk Usage: Mail'
        };
etc.
Which is what I want.

However, when I make the values of %data into array refs, so as to be
able to push more data onto them later, I get a reference to the
*same* hash as my %domains hash values:

my %data = (
	du_w => ['Disk Usage: Web'],
	du_m => ['Disk Usage: Mail'],
	tot_du => ['Total Disk Usage'],
	);

my %domains = map {$_ => {%data} } grep !/^\.\.?/ -d, readdir D;

Gets me:
$VAR1 = 'anticbressol';
$VAR2 = {
          'tot_du' => [
                        'Total Disk Usage'
                      ],
          'du_w' => [
                      'Disk Usage: Web'
                    ],
          'du_m' => [
                      'Disk Usage: Mail'
                    ]
        };
$VAR3 = 'boixados';
$VAR4 = {
          'tot_du' => $VAR2->{'tot_du'},
          'du_w' => $VAR2->{'du_w'},
          'du_m' => $VAR2->{'du_m'}
        };

Could someone please explain why this is? Thank you very much!

-- 
All the best,
Lou Hevly
lou@visca.com
http://www.visca.com


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

Date: Fri, 26 Jan 2001 01:24:26 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: How to compile a perl file ?
Message-Id: <slrn971kmp.94m.tim@degree.ath.cx>

Ricky <ricky@mymail.faq> wrote:
> Immagine I have:
> 
> #!/usr/bin/perl
> print "Hello world!";
> <STDIN>;
> 
> and that is called file.pl
> I tried :
> perlcc -gen -C file.c file.pl (and does not work)
> perlcc file.pl (and does not work)
> etc...
> 
> I would like to compile a file, does not matter if I only get C code, I can
> compile it later, no?
> I read a lot of docs, but I do not understand, nothing works !!!

I have no way of knowing what's going wrong.  We need more information
as to your problem.  It's a good, no: excellent, idea to include _why_
it "does not work."  Error messages would be a great start.

HTH

-- 
-Tim Hammerquist <timmy@cpan.org>
Dozens of people spontaneously combust each year,
it's just not really widely reported.
	-- David St. Hubbins, "This is Spinal Tap"


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

Date: 25 Jan 2001 23:53:40 GMT
From: Sara Dunn <usdpd@jeeves.bimcore.emory.edu>
Subject: LWP/ Web Login Advice Needed
Message-Id: <94qea4$lvc$1@finch.mathcs.emory.edu>

Okay here is the situation I wish to address using Perl 

There is a remote Web service that people will log into which 
requires a userid and password. I want to protect that password 
and instead have them log into a local page on a local server 
using a local userid and password 
which is , of course, different from the set used to get into 
the remote service. Then once authenticated at the local site
my CGI will pass the real userid/password combo onto the remote
site and redirect the user. 

Can I accomplish this using LWP and HTML modules ? The remote
service has a form which supports the PUT method which as
I understand it should easily be handled with the aforementioned
Perl modules. 

Thanks


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

Date: 25 Jan 2001 21:04:55 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Passing parameters to a script
Message-Id: <itn3t6ew.fsf@pobox.com>

mmanso@localhost.localdomain (Miguel Manso) writes:

> I'm trying to write a perl script that accepts three optional
> parameters.

You must identify each of the options on the command line, as in

   $ myscript -d d_argument -g g_argument

"How do you manage that?" you say?  I just made a handout for my Perl
class on this very subject.  Here ya go.  Please note that this class
is geared towards the use of Perl in the Win32 environment.

Command Line Switches

Many Windows programs take a number of switches, or options, that
modify their behavior.  Even if you have very little experience with
the command prompt, you probably know that you change directories
using the "cd" command.  What you might not have known is that you can
give the cd command the option /D to tell it to change to a different
drive as well as a different directory, so that instead of having to
type

    C:\>e:

    E:\>cd projects

    E:\projects>

You can just type

    C:\>cd /d e:\projects

    E:\projects>

In the world of Unix, and therefore in the world of Perl, switches are
preceded not with forward slashes, but with minus signs, like "-d".
There are several modules in the standard Perl distribution that make
it easy enough to parse command line switches.  We will use
Getopt::Std.  The technique I'll describe to you here is just one of
the ways to use it; you can read more about it in the Activestate HTML
documentation.  To use Getopt::Std, you'll be surprised to hear that
you

    use Getopt::Std;

You'll then set aside a hash to receive the options chosen by the
user:

    my %opts;

Finally, you call the subroutine getopts, like so:

    getopts( 'dsn:', \%opts );

Whoa, what is all that junk?  That first argument tells getopts to
look for switches "-d", "-s", and "-n".  The -d and -s switches are
either there or not; they are "boolean".  The colon ":" after the "n"
tells getopts that the -n switch takes an argument.  If, for example,
your script is called do_something.pl, and the -n switch tells
do_something.pl how many times to do its thing, the command line might
look like

    c:\> do_something.pl -s -n 12

The switches can come in any order, so that the user could achieve the
same effect with

    c:\> do_something.pl -n 12 -s

The second argument to getopts is that hash you declared earlier, but
with a backwhack prefixed.  That backwhack constructs a reference to
your hash.  Do not worry about the meaning of references yet.  For
now, let it be enough to know that in order for getopts to change your
hash it needs a reference to it. 

Once getopts finishes its work, @ARGV will no longer have those
switches in it, and %opts will contain the keys 'd', 's', and 'n', if
those options were set on the command line.  If an option (like -n in
our example) takes an argument, then the value of that hash entry will
be the argument; otherwise, the value is 1.  So, to check to see if
the user included the -d switch, you'd use "exists $opts{'d'}".

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Fri, 26 Jan 2001 00:59:54 GMT
From: "Vogelfrei" <zarathustra@enviroweb.org>
Subject: Re: pdf2html
Message-Id: <e_3c6.10806$KJ3.657789@newsread2.prod.itd.earthlink.net>


<philhibbs@my-deja.com> wrote in message news:94p358$5br$1@nnrp1.deja.com...
>
> I've tried WinPDFData but can't get it to work.

You may want to look at Pdftohtml
http://www.ra.informatik.uni-stuttgart.de/~gosho/pdftohtml/ which is based
on Xpdf.





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

Date: Thu, 25 Jan 2001 23:34:57 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Precision? (was: Perl is bad at (very) simple math!)
Message-Id: <94qd71$di5$1@nnrp1.deja.com>

In article <t70pai1fh08r2b@corp.supernews.com>,
  Chris Stith <mischief@velma.motion.net> wrote:
> philhibbs@my-deja.com wrote:
>> In article <t6ui3ecdn4pn39@corp.supernews.com>,
>>   Chris Stith <mischief@velma.motion.net> wrote:
>>> I wouldn't call that failing. Figure out for yourself how to
>>> represent 0.1 in binary.

>> Well, I'd use one of the x87 BCD floating point formats, if I was
>> doing it on an Intel CPU.

> I might do the same if I was going to run _only_ on Intel
> x86 CPU-based machines. One of Perl's greatest strengths
> is its portability. I the core had a different math engine
> for every platform...

This brings me to the question about precision that can be expected from
Perl.  On each of my Pentium III Linux box, a MIPS R10000 Siemens
Reliant Unix and an Ultra-4 Sparc Solaris I get:

$ perl -e 'print 1e9|1,"\n", 1e10|1,"\n", 1e15-1,"\n", 1e15+1,"\n"'
1000000001
4294967295
999999999999999
1e+15

which seems to suggest that 1e9 is the biggest power-of-ten-integer
while 1e15 seems to be the biggest integrally precise
power-of-ten-float.  But is this universally true, or does it depend on
the underlying architecture and/or C compiler?  And if so, what is the
best way to find out?

thanks -- Daniel

--
Bring text-docs to life!              Erwecke Textdokumente zum Leben!
                   http://beam.to/iPerl/
Vivigu tekstodokumentojn!


Sent via Deja.com
http://www.deja.com/


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

Date: 25 Jan 2001 18:10:29 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: regex question
Message-Id: <m37l3jp6sa.fsf@mumonkan.sunstarsys.com>

"chris w." <chrisw@ec2.edu> writes:

> I'm to look through a file and remove duplicates of a particular 
> string, separated by whitespace. Here is an example of the file:
> 
> -----------------------------
> <p>           <p>
>      <p>    <p>Blah-blah-blah
> ------------------------------
> 
> I started out trying to use something like:
> 
> s/<p>\s+<p>/<p>/g;
> 
> Which everyone here will see that it only solves my problem half-
> way. I'm not sure if there is a way to substitute one-or-more <p> 
> with just one <p> without going beyond a regular expression.

One way would be to slurp the whole file into a variable and look 
for multiple consecutive matches.  If I understand you, something 
like this might work:
==================================================
#!/usr/bin/perl -w

$_ = <<TEXT; # slurp the file into $_
<p>           <p>
     <p>    <p>Blah-blah-blah
TEXT

# finds multiple duplicates
s/<p>(?:\s+<p>)+/<p>/g;

print;
==================================================

% try.pl
<p>Blah-blah-blah
%

HTH
-- 
Joe Schaefer


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

Date: Fri, 26 Jan 2001 00:25:03 GMT
From: "Daniel W. Burke" <dwb1@home.com>
Subject: Re: right place for a mod_perl question?
Message-Id: <Pine.LNX.4.20.0101251929560.17945-100000@ethyl.addictmud.org>

On 25 Jan 2001, Gary E. Ansok wrote:

> In article <Pine.LNX.4.20.0101250858170.17416-100000@ethyl.addictmud.org>,
> Daniel W. Burke <dwb1@home.com> wrote:
> 
> >&SomeFunc;
> >
> ># blah blah...
> >
>
> When you call a function using &SomeFunc, @_ is left alone.
> In other words, &SomeFunc is equivalent to &SomeFunc(@_),
> not &SomeFunc().  
> 
>         &NAME;         # Makes current @_ visible to called subroutine.
> 
> >and the variable is set to "Apache=SCALAR(0x????????)"... I checked
> 
> Yup, the value you're seeing looks like a reference to an Apache object,
> which is commonly passed as the first parameter to a method function.
> 
> >&SomeFunc(); # note the () added
> 
> That's the way to go.  Actually, you don't even need the "&" any more.
> 
> Unfortunately, I don't see any way to really fix the problem without
> modifying every call to the function.  
> 

Thanks for the helpful information...

It seems weird that mod_perl is passing the apache object to each script in
@_, but if each script is called like a function inside the interpreter, I
guess it makes sense...

What I ended up doing, and I don't know if this is the best way to go but it
seems to work on a global scale, I modified every script and added this line
to the top:

shift if (defined($_[0]));

The "if defined" bit is probably unnecessary, but a co-worker agreed that it
makes the shift look more useful and avoids being grilled by the B.O.S.S.
next time he looks at any of our code... ;)

Is there any reason this kind of fix would be bad?  Also, if that's the
apache object, where can I find the documentation on how to use it in that
form?  It just looks like a reference to a scalar....

Thanks, the people in this newsgroup have always been great help when I 
run into trouble...

Dan.






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

Date: Thu, 25 Jan 2001 23:18:14 GMT
From: eggie@REMOVE_TO_REPLYsunlink.net (James Kufrovich)
Subject: Script to "rotate" the chars in a string.
Message-Id: <slrn971d6r.emp.eggie@melody.mephit.com>

Hi.

	I just put together a small script (at the bottom there) that will
rotate the characters in a string (supplied on the command line) and print
the resulting string out, both forwards and backwards.  In other words,
giving the program the string "funky" will produce the following output:

funky
unkyf
nkyfu
kyfun
yfunk
yknuf
knufy
nufyk
ufykn
fyknu

	For anyone who subscribes to Games magazine, yes, this is to help
solve the "Rows Garden" puzzles.  Anyway, the script below works,
splitting the string into an array of its characters, and rotating that.
I'm sure it can be made shorter somehow, but I don't know how.  Any
suggestions?  Or any ideas for a different approach?  Thanks.

Jamie Kufrovich
---------------------------------
#!/usr/bin/perl -w

use strict;

(my $string = $ARGV[0]) or die "Usage:  wordrotate.pl <string>\n";

my @forwards = split (//,$string); 
my @backwards = reverse @forwards;

rotate (\@forwards);
rotate (\@backwards);


sub rotate {
  my @array = @{ shift(@_) };
  for (0 .. $#array) {
    print foreach (@array);
    print "\n";
    push (@array, (shift @array));    
  }
}

-- 
Egg, eggie@REMOVE_TO_REPLYsunlink.net
FMSp3a/MS3a A- C D H+ M+ P+++ R+ T W Z+ 
Sp++/p# RLCT a+ cl++ d? e++ f h* i+ j p+ sm+


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

Date: Fri, 26 Jan 2001 00:33:23 GMT
From: egwong@netcom.com
Subject: Re: Script to "rotate" the chars in a string.
Message-Id: <nB3c6.19533$J%.1481087@news.flash.net>

James Kufrovich <eggie@remove_to_replysunlink.net> wrote:
> 	I just put together a small script (at the bottom there) that will
> rotate the characters in a string (supplied on the command line) and print
> the resulting string out, both forwards and backwards.  In other words,
> giving the program the string "funky" will produce the following output:

James,

Instead of using arrays and stack operations, you can take double the
string (i.e. string = string.string) and do a simple substr:

    sub substr_rotate {
        my $string = shift();
        my $len = length($string);
        $string .= $string;
    
        for ( 0 .. $len ) {
            substr( $string, $_, $len );      
        }
    }

It's substantially faster under Benchmark.

  Benchmark: running stack, substr, each for at least 5 CPU seconds...
       stack:  6 wallclock secs ... (n=217097)
      substr:  6 wallclock secs ... (n=632470)

             Rate  stack substr
  stack   41830/s     --   -65%
  substr 118440/s   183%     --
  
Out of curiosity, what's the "Rows Garden" puzzle?

HTH,
Eric


p.s. in case anyone is wondering, stack is

    sub stack_rotate {
        my @array = split(//, shift );
    
        for ( 0 .. $#array ) {
            push( @array, (shift @array) );
            join( '', @array );  
        }
    }


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

Date: 26 Jan 2001 01:51:06 +0100
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: Script to "rotate" the chars in a string.
Message-Id: <snm7qgp1.fsf@macforce.sumus.dk>

eggie@REMOVE_TO_REPLYsunlink.net (James Kufrovich) writes:

> Anyway, the script below works,
> splitting the string into an array of its characters, and rotating that.
> I'm sure it can be made shorter somehow, but I don't know how.  Any
> suggestions?  Or any ideas for a different approach?  Thanks.

This is not necessarily better but it's shorter and certainly more fun :-)

#!/usr/bin/perl -w

use strict;

my $s = $ARGV[ 0 ] or die "Usage:  wordrotate.pl <string>\n";

for ( 1..2 ) {
    for ( 1..length( $s ) ) { $s = substr $s x 2, print( "$s\n" ), length $s }
    $s = join '', reverse split //, $s;
}


-- 
Jakob Schmidt
http://aut.dk/orqwood
etc.


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

Date: 26 Jan 2001 00:08:30 +0100
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: simple question for probably all of you... about @
Message-Id: <wvbjqlg1.fsf@macforce.sumus.dk>

"Mike" <verdien_guldens@hotmail.com> writes:

> Dear all
> 
> How do I write '@' on my screen between two fields..

Presuming that the problem arisis in some form of variable-expanding quoting
escape the @ with \

print "$x\@$domain\n";

HTH

-- 
Jakob Schmidt
http://aut.dk/orqwood
etc.


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

Date: Fri, 26 Jan 2001 00:44:45 +0100
From: "Mike" <verdien_guldens@hotmail.com>
Subject: Re: simple question for probably all of you... about @
Message-Id: <3a70ba89$0$12250@reader4>

Thank you... it works

Kind regards,
Mike

"Jakob Schmidt" <sumus@aut.dk> wrote in message
news:wvbjqlg1.fsf@macforce.sumus.dk...
> "Mike" <verdien_guldens@hotmail.com> writes:
>
> > Dear all
> >
> > How do I write '@' on my screen between two fields..
>
> Presuming that the problem arisis in some form of variable-expanding
quoting
> escape the @ with \
>
> print "$x\@$domain\n";
>
> HTH
>
> --
> Jakob Schmidt
> http://aut.dk/orqwood
> etc.




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

Date: Fri, 26 Jan 2001 12:09:40 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: String comparing?
Message-Id: <slrn971jik.n5q.mgjv@martien.heliotrope.home>

On Thu, 25 Jan 2001 16:56:18 +0200,
	Bonehead <wavetable@birdmail.com> wrote:
> Bernard El-Hagin" <bernard.el-hagin@lido-tech.net> wrote in message
> news:slrn970esi.2q0.bernard.el-hagin@gdndev25.lido-tech...> On Thu, 25 Jan
> 2001 16:36:19 +0200, Bonehead <wavetable@birdmail.com>
>> GUARANTEE that someone will help you fix it. Just show some effort and
>> stop trying to get a free script out of this group. That's not what it's
>> here for.
> 
> I'm not asking for a "free script" when I'm asking about how to compare two
> strings.

You will need to read some documentation. If you want to program, you
will need to learn the language. We can give you what you ask for, if
you ask for it in a way that we can understand it, but that isn't
helping you, because you don't learn anything.

Take the advice given, and read the perlop, perlre, perlfunc, perlsyn
and perldata documentation. Then read the whole of the perl FAQ. You
should be able to do what you want easily then.

ou are talking about reading lines from a file, and thinking the line
end is in the way. Then don't leave the line end in. That's what the
chomp function is for:

(none of the following code has been tested or run.It's here to give you
a guideline to things to look up in the doucmentation)

open(F, $file) or die "Can't open $file: $!";
while (my $record = <F>)
{
	chomp $record;
	# do something with record
}
close(F);

Or you can chomp a whole array, if you've read the lines in one.

To compare strings:

From perlop and perlfunc:

if ($string eq $record) {} # exact equality
if (index($record, $string) >= 0) {} # $record contains string
if (index($record, $string) == 0) {} # $record starts with $string
if (index(reverse($record), reverse($string)) == 0)
	# $record ends with $string

From perlop and perlre:

if ($record =~ /^\Q$string\E$/) {} # $record equals $string
if ($record =~ /\Q$string/) {}  # $record contains $string
if ($record =~ /^\Q$string/) {} # $record starts with $string
if ($record =~ /\Q$string\E$/) {} # $record ends with $string

Now, read the documentation, understand what the above things
do, and remember where you found the explanations. Understanding, and
knowing how to use documentation are much more powerful than posting to
Usenet.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I took an IQ test and the results
Commercial Dynamics Pty. Ltd.   | were negative.
NSW, Australia                  | 


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V10 Issue 146
**************************************


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