02-12-2009
You can't have two else conditions in perl. You can have:
if/elsif/else
with as many 'elsif' conditions as needed and the 'else' on the end is optional
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I know this must be really easy, but i can't get it to work
I've got a perl script, with a file.
I want to print an empty line, and the following doesn't seem to work:
print nameoffile "\n"
thanks for your help!! (3 Replies)
Discussion started by: kfad
3 Replies
2. UNIX for Dummies Questions & Answers
How can I use Perl to a take a string of 10 characters and print the last five characters of the string in columns 1-5 and the first five in columns 6-10?
Result:
0123456789
5 0
6 1
7 2
8 3
9 4 (5 Replies)
Discussion started by: doubleminus
5 Replies
3. Shell Programming and Scripting
Hi All,
I have the following sql query
select abcd from udbadm.log where xyz='1'.
I have 16k queries similar to this with different values for xyz.
I want to print the values of 'abcd' for each row.
I have the following perl code, but not sure how i can print that particular... (1 Reply)
Discussion started by: userscript
1 Replies
4. Shell Programming and Scripting
Hey Guys,
I have some weird problem with printing scalars ...
When I'm executing script both are printing in terminal ...
But only one is printed to the file ?
I don't know whats going on .. :)
Btw .. I'm noobie :) took me lots of time to put this simple script together :)
Thank you... (3 Replies)
Discussion started by: NDxiak
3 Replies
5. Shell Programming and Scripting
Hi there
I have a hash of hashes made up of the following data
bge0|100|half|10.36.100.21
bge1|1000|full|10.36.100.22
bge2|1000|full|10.36.100.23
which when i turn into a hash, would look like this inside the system
bge0 ->
nic_speed -> 100
nic_duplex -> half
... (6 Replies)
Discussion started by: hcclnoodles
6 Replies
6. Shell Programming and Scripting
Can we please modify this perl one-liner to print lines between pattern1 and pattern2 in a file?
Currently it prints lines till pattern2. (4 Replies)
Discussion started by: anand_bh
4 Replies
7. Emergency UNIX and Linux Support
My script below is supposed to log in to my vB account on any vB forum I'm registered on and retrieve + print my security token. However it seems to be hit and miss. The logging in works perfectly just will not retrieve and print the security token for every forum I log in to. Code Below:
... (3 Replies)
Discussion started by: AndrewTwain
3 Replies
8. Shell Programming and Scripting
Hi,
I have a file with lines like this.
2 7 18 ggcgt anna
2 7 18 hhchc sam
3 7 18 hhdjcc ross
4 7 18 hhcjd jenny
0 8 21 jjdhs sam
3 8 21 kkok bush
2 9 24 kosss BrenhamIf the values of the second column are equal, print only those lines with the least first column value. So in... (5 Replies)
Discussion started by: polsum
5 Replies
9. Shell Programming and Scripting
Hey guys i am using perl and trying to pull a list of books from a database and then populate the list in a separate TT2 file. When the list is generated there should be 39 book names. When I do the foreach statement in my tt2 below, the first statement gives me 39 Array(random number) and the... (1 Reply)
Discussion started by: Joey12
1 Replies
10. Shell Programming and Scripting
I got multiple of documents in which i have to extract a line coming after a ID..The scenario is
Customer ID: none
VT : 002/89
Customer ID: Yes
VT: 001/89
Customer ID: none
VT: 006/85
Customer ID: Yes
VT: 003/56
I have to extract the id which is coming after YES..The output... (7 Replies)
Discussion started by: rajkrishna89
7 Replies
LEARN ABOUT DEBIAN
webkdc
WebKDC(3pm) User Contributed Perl Documentation WebKDC(3pm)
NAME
WebKDC - functions to support the WebKDC
SYNOPSIS
use WebAuth;
use WebKDC;
use WebKDC::Exception;
use WebKDC::WebRequest;
use WebKDC::WebResponse;
my ($status, $exception) =
WebKDC::make_request_token_request($req, $resp);
DESCRIPTION
WebKDC is a set of convenience functions built on top of mod WebAuth to implement the WebKDC.
All functions have the potential to throw either a WebKDC::WebKDCException or WebAuth::Exception.
EXPORT
None
FUNCTIONS
make_request_token_request(req,resp)
($status, $e) = WebKDC::make_request_token_request($req, $resp);
Used to handle an incoming request token. It should be used in the following fashion:
my $req = new WebKDC::WebRequest;
my $resp = new WebKDC::WebResponse;
# if the user just submitted their username/password, include them
if ($username && $password) {
$req->user($username);
$req->pass($password);
}
# pass in any proxy-tokens we have from a cookies
# i.e., enumerate through all cookies that start with webauth_wpt
# and put them into a hash:
# $cookies = { "webauth_wpt_krb5" => $cookie_value }
$req->proxy_cookies($cookies);
# $req_token_str and $service_token_str would normally get
# passed in via query/post parameters
$req->request_token($req_token_str);
$req->service_token($service_token_str);
my ($status, $e) = WebKDC::make_request_token_request($req, $resp);
# for all these cases, check if $resp->proxy_cookies() has any
# proxy cookies we need to update when sending back a page to
# the browser
if ($status == WK_SUCCESS) {
# ok, request successful
} elsif ($status == WK_ERR_USER_AND_PASS_REQUIRED
|| $status == WK_LOGIN_FORCED) {
# prompt for user/pass
} elsif ($status == WK_ERR_LOGIN_FAILED) {
# supplied user/pass was invalid, try again
} else {
# use this if/elsif/else to pick the error message
if ($status == WK_ERR_UNRECOVERABLE_ERROR) {
# something nasty happened.
} elsif ($status == WK_ERR_REQUEST_TOKEN_STATLE) {
# user took too long to login, original request token is stale
} elsif ($status == WK_ERR_WEBAUTH_SERVER_ERROR) {
# like WK_ERR_UNRECOVERABLE_ERROR, but indicates the error
# most likely is due to the webauth server making the request,
} else {
# treat like WK_ERROR_UNRECOVERABLE ERROR
}
# display the error message and don't prompt anymore
}
AUTHOR
Roland Schemers (schemers@stanford.edu)
SEE ALSO
WebKDC::WebKDCException WebKDC::Token WebKDC::WebRequest WebKDC::WebRespsonse WebAuth.
perl v5.14.2 2012-04-25 WebKDC(3pm)