Sponsored Content
Full Discussion: Perl qr function usage
Top Forums Shell Programming and Scripting Perl qr function usage Post 303017130 by timj123 on Wednesday 9th of May 2018 03:54:20 PM
Old 05-09-2018
Perl qr function usage

I'm not sure why I'm having so much trouble with this.
I think I'm really not understanding how this works.

I'm trying to store a regex in a variable for use later in a script.

Can someone tell me why this doesn't match???
Code:
#!/usr/bin/perl
#
#
#
$ticket=1212;

my $rx_ticket = qr/^\d{4}$/;

if ($ticket !~ /$rx_ticket/) {
        print "It matches\n";
}
else {
        print "No match\n";
}


print "Finished\n\n";
print "$ticket\n";

I expected it to match, but I get the following output:

Code:
$ ./ticket.pl
No match
Finished

1212

What am I not understanding here???
I'm sure it something simple.

Thanks
 

10 More Discussions You Might Find Interesting

1. Solaris

memory usage function

Hi all, I am developing a C++ application on Sun Solaris. Is there any function bundled in the C++ library that can display memory usages of a process? I dont want use command. Many thanks. Lan (1 Reply)
Discussion started by: lanchen
1 Replies

2. Shell Programming and Scripting

Perl Split Command usage

Hi, I am trying to use the split commad to seperate string reading from file. but it dosent give me a correct result. can some body tell me what is the wrong in following scritp. #!/usr/bin/perl -w #use CGI qw(:standard); ... (2 Replies)
Discussion started by: maheshsri
2 Replies

3. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

4. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

5. Shell Programming and Scripting

Perl Array / pattern match large CPU usage

Hi, I have one file in this format 20 value1 33 value2 56 value3 I have another file in this format: 34,30-SEP-09,57,100237775,33614510126,2,34 34,30-SEP-09,57,100237775,33620766654,2,34 34,30-SEP-09,108,100237775,33628458122,2,34 34,30-SEP-09,130,100237775,33635266741,2,254... (6 Replies)
Discussion started by: Donkey25
6 Replies

6. Shell Programming and Scripting

usage of AWK command under perl script

i have two files as shown below t1.txt: argument1 argu2 argu37 t2.txt: 22 33 44 i want o/p as argument1 22 argu2 33 argu37 44 i am trying to merge two file under perl script using following system("paste t1.txt t2.txt | awk... (3 Replies)
Discussion started by: roopa
3 Replies

7. HP-UX

Perl script limit cpu usage

Hi Experts, I am executing multiple instances(in parallel) of perl script on HP-UX box. OS is allocating substantial amount of CPU to these perl processes,resulting higher cpu utilization. Glance always shows perl processes are occupying majority of the CPU resource. It is causing slower... (2 Replies)
Discussion started by: sai_2507
2 Replies

8. Shell Programming and Scripting

Usage of $$ and @_ in perl

Hi I have some doubts with below perl script sub program . In the below code what are below lines do ? 1. ($user, $server, $os, $version, $ref_path, $ref_line, $ref_ftp) = @_; 2. if ( -e "/usr/kerberos/bin/krsh" ) 3. $$ref_path = "/usr/kerberos/bin" unless ($$ref_path);why we are... (1 Reply)
Discussion started by: ptappeta
1 Replies

9. Shell Programming and Scripting

Usage of shell variable in perl command

Hi, I have a shell script, In which i have variable "var1" and some perl command inside shell script. export var1='coep -n rst-a2p-hinje.vci.all.com -c' perl -pi -e 's/^/coep -n rst-a2p-hinje.vci.all.com -c /' command.txt currently I am adding value of var1 in command.txt file by... (2 Replies)
Discussion started by: rakeshtomar82
2 Replies

10. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
kinit(8krb)															       kinit(8krb)

Name
       kinit - Kerberos login utility

Syntax
       /usr/bin/kinit [ -irv ]

Description
       You  use the command to log into the Kerberos authentication and authorization system.  You also use the command when your original tickets
       have expired.  When you use the command without options, the utility prompts for a username and a Kerberos password and attempts to authen-
       ticate to the local Kerberos server.

       If  Kerberos  authenticates you correctly, retrieves your initial ticket and puts it in the ticket file specified by the KRBTKFILE environ-
       ment variable.  If you have not defined this variable, the ticket is stored in the file

       Make sure you use the command to destroy any active tickets before ending your login session.  You may want to put the command in a file so
       that all tickets are destroyed automatically when you log out.  Only registered Kerberos users can use the Kerberos system.

Options
       -i     Causes to prompt you for a Kerberos instance.

       -r     Causes to prompt you for a Kerberos realm.  This option lets you authenticate yourself with a remote Kerberos server.

       -v     Initiates verbose mode.	This causes to print the name of the ticket file used and a status message indicating the success or fail-
	      ure of your login attempt.

Restrictions
       Although user-level authentication is not supported, is useful for testing the installation of Kerberos functionality, by determining if  a
       newly  installed  principal  can  obtain  a  ticket-granting  ticket.  For example, to determine if the running on machine X can obtain its
       ticket-granting ticket, you can run input the principal name, the instance, X, and the password of If succeeds, then Kerberos is  correctly
       installed on machine X.

       The option has not been fully implemented.

Files
       See Also
	      kdestroy(8krb), klist(8krb)

																       kinit(8krb)
All times are GMT -4. The time now is 06:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy