Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Perl 5.0 ? Or some problem with Regular expressions #664

Closed
p5pRT opened this issue Sep 30, 1999 · 2 comments
Closed

Bug in Perl 5.0 ? Or some problem with Regular expressions #664

p5pRT opened this issue Sep 30, 1999 · 2 comments

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Sep 30, 1999

Migrated from rt.perl.org#1544 (status was 'resolved')

Searchable as RT1544$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Sep 30, 1999

From alex@gypsy.liquidaudio.com

-----------------------------------------------------------------
My script needs to call different functions according to the value
of the $mode variable. If $mode = d it will be calling function 1
and if $mode = c it will be calling function 2. Or if $mode = a it
will be calling all the functions.

Here is the script

#! /usr/local/bin/perl

my $mode ="a";
my $c_over =0;
my $d_over =0;

if ($mode =~ /c|a/gi and $c_over==0){
  print "\n Calling Function 1";
  # do function1
  $c_over =1;
  $d_over =0;
}

if ($mode =~/d|a/gi and $d_over ==0){
  print "\n Calling Function 2";
  # do function2
  $d_over =1;
}

print "\n Process over \n\n";
+++++++++++++++++++++++++++++++++++++++++++++++
The output is

Calling Function 1
Process over

++++++++++++++++++++++++++++++++++++++++++++++

I found out that performing these comparisons on the same variable often
fails the second time. And if theres an 3rd comparison, it works out
fine the third time! Is there anyway of flushing out the previous results
or something like that!
I 've put this question in comp.lang.perl.misc and got no answer so far.

Hope I get an answer from the perl-team atleast.

Perl Info


Site configuration information for perl 5.00404:

Configured by root at Thu Apr  1 11:19:44 PST 1999.

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos gypsy 5.6 generic_105181-03 sun4u sparc sunw,ultra-250 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='/usr/local/bin/gcc', optimize='-O', gccversion=2.8.1
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='/usr/local/bin/gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'

Locally applied patches:
	


@INC for perl 5.00404:
	/usr/local/lib/perl5/sun4-solaris/5.00404
	/usr/local/lib/perl5
	/usr/local/lib/perl5/site_perl/sun4-solaris
	/usr/local/lib/perl5/site_perl
	.


Environment for perl 5.00404:
    HOME=/
    LANG (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/etc:/sbin:/etc:/usr/ccs/bin:/opt/gnu/bin:/usr/ucb:/usr/bin/X11:/usr/openwin/bin:/usr/local/Minerva/bin:/usr/local/mysql/bin:.
    PERL_BADLANG (unset)
    SHELL=/bin/ksh

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Sep 30, 1999

From [Unknown Contact. See original ticket]

alex rayan writes​:

I 've put this question in comp.lang.perl.misc and got no answer so far.

This does not suddently makes p5p into a help desk. Look for
documentation of //g which you are using.

Ilya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant